[PATCH v2 0/2] MR4793: ntdll/tests: Restore x86-64 #AC exception test in test_exceptions().
The old code did indirect jmp with a misaligned operand address. -- v2: ntdll/tests: Restore x86-64 #AC exception test in test_exceptions(). ntdll/tests: Avoid misaligned load in exception handler code in run_exception_test_flags(). https://gitlab.winehq.org/wine/wine/-/merge_requests/4793
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com> This is required for testing EH behavior on alignment check (#AC) exceptions. --- dlls/ntdll/tests/exception.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index bac571b2733..87bee9d8e93 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -3193,7 +3193,7 @@ static void run_exception_test_flags(void *handler, const void* context, const void *code, unsigned int code_size, DWORD access, DWORD handler_flags) { - unsigned char buf[8 + 6 + 8 + 8]; + unsigned char buf[2 + 8 + 2 + 8 + 8]; RUNTIME_FUNCTION runtime_func; UNWIND_INFO *unwind = (UNWIND_INFO *)buf; void (*func)(void) = code_mem; @@ -3212,11 +3212,13 @@ static void run_exception_test_flags(void *handler, const void* context, *(ULONG *)&buf[4] = 0x1010; *(const void **)&buf[8] = context; - /* jmp near */ - buf[16] = 0xff; - buf[17] = 0x25; - *(ULONG *)&buf[18] = 0; - *(void **)&buf[22] = handler; + /* movabs $<handler>, %rax */ + buf[16] = 0x48; + buf[17] = 0xb8; + *(void **)&buf[18] = handler; + /* jmp *%rax */ + buf[26] = 0xff; + buf[27] = 0xe0; memcpy((unsigned char *)code_mem + 0x1000, buf, sizeof(buf)); memcpy(code_mem, code, code_size); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4793
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com> --- dlls/ntdll/tests/exception.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/tests/exception.c b/dlls/ntdll/tests/exception.c index 87bee9d8e93..da78939b47e 100644 --- a/dlls/ntdll/tests/exception.c +++ b/dlls/ntdll/tests/exception.c @@ -3439,7 +3439,7 @@ static DWORD WINAPI align_check_handler( EXCEPTION_RECORD *rec, ULONG64 frame, #ifdef __GNUC__ __asm__ volatile( "pushfq; andl $~0x40000,(%rsp); popfq" ); #endif - ok (!(context->EFlags & 0x40000), "eflags has AC bit set\n"); + ok (!!(context->EFlags & 0x40000), "eflags has AC bit unset\n"); got_exception++; return ExceptionContinueExecution; } @@ -3581,12 +3581,10 @@ static void test_exceptions(void) ok(got_exception == 3, "expected 3 single step exceptions, got %d\n", got_exception); /* test alignment exceptions */ - if (0) /* broken on Windows */ - { got_exception = 0; run_exception_test(align_check_handler, NULL, align_check_code, sizeof(align_check_code), 0); - ok(got_exception == 0, "got %d alignment faults, expected 0\n", got_exception); - } + todo_wine + ok(got_exception == 1, "got %d alignment faults, expected 1\n", got_exception); /* test direction flag */ got_exception = 0; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4793
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=141631 Your paranoid android. === w7pro64 (64 bit report) === ntdll: exception: Timeout
participants (3)
-
Jinoh Kang -
Jinoh Kang (@iamahuman) -
Marvin