-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ASSERT core/nudge.c:521 hthread != INVALID_HANDLE_VALUE #1309
Comments
This is causing tests on win8 through win10 to fail: #1432, #2835. NtCreateThread is returning 0xc0000022 == STATUS_ACCESS_DENIED |
Since NtCreateThread returns STATUS_ACCESS_DENIED on win8+, we implement a solution for internal nudges using NtCreateThreadEx. We already have support for varying who frees the stack in NUDGE_NUDGER_FREE_STACK, which we leverage here. The other complication is who frees the arg_buf for a remote process (since we can't easily put it on the stack): again, we already have NUDGE_FREE_ARG which we use here. We also fix a bug in cleanup_and_terminate that results in a double-free of a nudge dstack: a simple 1-byte-bool error where our asm checks all 4 bytes. A similar asm bug found by inspection with sig_should_swap_stack() is also fixed. This fixes internal nudges. Client threads and external nudges will be fixed separately. Issue: #1309, #1432, #2835
Since NtCreateThread returns STATUS_ACCESS_DENIED on win8+, we implement a solution for internal nudges using NtCreateThreadEx. We already have support for varying who frees the stack in NUDGE_NUDGER_FREE_STACK, which we leverage here. The other complication is who frees the arg_buf for a remote process (since we can't easily put it on the stack): again, we already have NUDGE_FREE_ARG which we use here. We also fix a bug in cleanup_and_terminate that results in a double-free of a nudge dstack: a simple 1-byte-bool error where our asm checks all 4 bytes. A similar asm bug found by inspection with sig_should_swap_stack() is also fixed. This fixes internal nudges. Client threads and external nudges will be fixed separately. Issue: #1309, #1432, #2835
For client threads where we want to use our dstack yet we're forced to use NtCreateThreadEx and its kernel-provided stack, we target a wrapper that switches stacks and calls the client thread function. We pass data to the wrapper on the dstack and pass the dstack as its parameter. Issue: #1309, #1432, #2835
We need to use NtCreateThreadEx for 3 things: internal nudges, client threads, and external nudges. For external nudges we should get the tests re-enabled: #120. |
For client threads where we want to use our dstack yet we're forced to use NtCreateThreadEx and its kernel-provided stack, we target a wrapper that switches stacks and calls the client thread function. We pass data to the wrapper on the dstack and pass the dstack as its parameter. Issue: #1309, #1432, #2835
Changes the libutil nudge code to use NtCreateThreadEx on Win8+. For a test, enables the client.nudge_test test, part of i#120: enable .runall tests on Windows. Here I added a new app win32.infloop to parallel linux.infloop, rather than launching calc.exe or notepad.exe like we did in the past (not yet tackling systemwide injection here). It has a MessageBox with a title containing the pid, allowing us to use tools/closewnd with a unique target name for a clean and race-free exit. win32.infloop also has a 3-minute timeout to avoid leaving stale processes behind in case of issues closing it externally. Revamped runall.cmake to work on Windows, using "ping" to sleep, updating nudge and close commands, removing stale pid files, etc. Ported suite code to use run_in_bg on Windows as well as Linux, but with the pidfile coming from drrun. Fixes #1309 Fixes #1432 Issue: #120, #1835
Changes the libutil nudge code to use NtCreateThreadEx on Win8+. For a test, enables the client.nudge_test test, part of i#120: enable .runall tests on Windows. Here I added a new app win32.infloop to parallel linux.infloop, rather than launching calc.exe or notepad.exe like we did in the past (not yet tackling systemwide injection here). It has a MessageBox with a title containing the pid, allowing us to use tools/closewnd with a unique target name for a clean and race-free exit. win32.infloop also has a 3-minute timeout to avoid leaving stale processes behind in case of issues closing it externally. Revamped runall.cmake to work on Windows, using "ping" to sleep, updating nudge and close commands, removing stale pid files, etc. Ported suite code to use run_in_bg on Windows as well as Linux, but with the pidfile coming from drrun. Fixes #1309 Fixes #1432 Issue: #120, #1835
From [email protected] on November 04, 2013 23:31:10
$ time ~/Workspace/DrMemory/builds/build_x86_drm_dbg.git/bin/drmemory.exe -debug -handle_leaks_only -callstack_max_frames 40 -- ./out/Debug/unit_tests.exe --gtest_filter=NativeMessagingTest.*
WARNING: using debug DynamoRIO since release not found
Dr.MDr. Memory version 1.6.1605Dr.MRunning "./out/Debug/unit_tests.exe --gtest_filter=NativeMessagingTest."Note: Google Test filter = NativeMessagingTest.
[==========] Running 3 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 3 tests from NativeMessagingTest
[ RUN ] NativeMessagingTest.SingleSendMessageRead
[ OK ] NativeMessagingTest.SingleSendMessageRead (5526 ms)
[ RUN ] NativeMessagingTest.SingleSendMessageWrite
[ OK ] NativeMessagingTest.SingleSendMessageWrite (639 ms)
[ RUN ] NativeMessagingTest.EchoConnect
Dr.MDr. Memory version 1.6.1605Dr.MRunning "C:\Windows\system32\cmd.exe /c "D:\src\chrome\src\chrome\test\data\native_messaging\native_hosts\echo.bat" --parent-window=0 chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/ < .\pipe\chrome.nativeMessaging.in.d1194e2a79c1824c > .\pipe\chrome.nativeMessaging.out.d1194e2a79c1824c"Dr.MWARNING: application is missing line number information.ASSERT error on core\nudge.c:521 hthread != INVALID_HANDLE_VALUE
It looks like the nudge_internal fail to create a new threads.
Original issue: http://code.google.com/p/dynamorio/issues/detail?id=1309
The text was updated successfully, but these errors were encountered: