-
Notifications
You must be signed in to change notification settings - Fork 565
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
[CRASH] Crash on Windows when dr_get_thread_id() or drwrap_get_retval() called in post-function callback #4068
Comments
Thanks for the report. Can you try getting a call-stack via WinDbg? |
As you can imagine, drwrap_get_retval() being called in the post-function callback is a pretty basic operation, and naturally we have tests for it. E.g.: The Ki one in particular is never called from user mode, so would drwrap ever call a post-function callback there? There is no "return address" like a regular function. Or does drwrap compute the return address from whatever is on top of the stack there and that bogus address messes things up? As @johnfxgalea said, a callstack of the crash would help. See the debugging page on our wiki for how to load symbols into windbg. |
This is not reproducible. dr_fprintf(STDERR, "retval=%p, tid=" TIDFMT "\n", drwrap_get_retval(wrapcxt), dr_get_thread_id(drwrap_get_drcontext(wrapcxt))); Marking as NeedInfo. The ball is in your court: how do you know this crash is inside DR code? I see at least one bug in the code you've linked: dr_get_thread_id returns a 64-bit value on Windows64. Please analyze the actual crash context and callstack, and analyze how to reproduce, as the current instructions do not reproduce any problem. |
Spent some time debugging this issue today. Seems like we are passing NULL as an argument for
Obvious fix is to check |
The docs for drwrap_wrap explain that NULL is deliberately passed for wrapcxt on abnormal unwind. It is thus up to the user of drwrap to check for it. |
Ok, thank you. I believe we can close this issue. |
Maybe a debug build check with a useful message about a deliberate NULL could be added to avoid future confusion. |
Describe the bug
When
dr_get_thread_id()
ordrwrap_get_retval()
is called in a post-function callback (i.e.: the function set as the third argument indrwrap_wrap_ex()
), a crash occurs.To Reproduce
Detailed instructions to reproduce can be found here: mxmssh/drltrace#5 (comment)
Note that crashing occurs when using the master branch of DynamoRIO (as of a few days ago).
I used the instructions for both 32-bit and 64-bit Release builds as documented here: https://github.com/mxmssh/drltrace/wiki/How-To-Build
Expected behavior
The
dr_get_thread_id()
anddrwrap_get_retval()
function should work as intended instead of crashing.Screenshots or Pasted Text
For a screen shot, see: mxmssh/drltrace#5 (comment)
Versions
The text was updated successfully, but these errors were encountered: