Skip to content
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

set up mcontext for app execution instead of taking over at our return #626

Closed
derekbruening opened this issue Nov 28, 2014 · 2 comments · Fixed by #5205
Closed

set up mcontext for app execution instead of taking over at our return #626

derekbruening opened this issue Nov 28, 2014 · 2 comments · Fixed by #5205

Comments

@derekbruening
Copy link
Contributor

From [email protected] on November 27, 2011 13:34:33

split from issue #234 for earliest injection:

 * XXX NOCHECKIN TOFILE: app_takeover sets preinjected for rct (should prob. rename)
 * which needs to be done whenever we takeover not at the bottom of the
 * callstack.  For earliest won't need to set this if we takeover
 * in such a way as to handle the return back to our hook code without a
 * violation -- though currently we will see 3 rets (return from
 * dynamorio_app_take_over(), return from here, and return from
 * dynamorio_earliest_init_takeover() to app hook code).
 * Should we have dynamorio_earliest_init_takeover() set up an
 * mcontext that we can go to directly instead of interpreting
 * the returns in our own code?  That would make tools that shadow
 * callstacks simpler too.

Original issue: http://code.google.com/p/dynamorio/issues/detail?id=626

@derekbruening
Copy link
Contributor Author

From [email protected] on April 26, 2013 09:47:41

probably we'd fix issue #1152 and issue #626 and issue #1105 simultaneously

@derekbruening
Copy link
Contributor Author

Windows thread injection was shifted a while ago to start at the app; the now-default map injection does have blocks with returns from DR but we plan to fix that in #4958.

Linux launch injection has always started at the app.

So this issue then would cover only the start/stop API? That seems reasonable to have the return from the API call. I think we can close this. (We did not solve #1152 or #1105 though.)

derekbruening added a commit that referenced this issue Nov 15, 2021
Switches Windows default map injection to record an app mcontext and
take over there, rather than taking over on the return path out of DR
functions and confusing clients with two initial blocks in the DR
library.

Tested by observing the block sequence in the log file.
Without the fix:
  Fragment 1, tag 0x000000001502643b, flags 0x1000630, shared, size 19:
          [dynamorio.dll~dynamorio_app_init_and_early_takeover+0x37b,~dr_persist_start-0x
  Fragment 2, tag 0x0000000015349c23, flags 0x1000030, shared, size 44:
          [dynamorio.dll~dynamorio_earliest_init_takeover+0x2d,~dr_virtual_query-0x24dfd]
  Fragment 3, tag 0x00007fff20502630, flags 0x9000630, shared, size 34:
          [ntdll.dll!RtlUserThreadStart]

With the fix:
  Fragment 1, tag 0x00007ffc25822630, flags 0x9000630, shared, size 34:
          [ntdll.dll!RtlUserThreadStart]

Issue: #4958, #626
Fixes #4958
Fixes #626
derekbruening added a commit that referenced this issue Nov 16, 2021
Switches Windows default map injection to record an app mcontext and
take over there, rather than taking over on the return path out of DR
functions and confusing clients with two initial blocks in the DR
library.

Tested by observing the block sequence in the log file.
Without the fix:
  Fragment 1, tag 0x000000001502643b, flags 0x1000630, shared, size 19:
          [dynamorio.dll~dynamorio_app_init_and_early_takeover+0x37b,~dr_persist_start-0x
  Fragment 2, tag 0x0000000015349c23, flags 0x1000030, shared, size 44:
          [dynamorio.dll~dynamorio_earliest_init_takeover+0x2d,~dr_virtual_query-0x24dfd]
  Fragment 3, tag 0x00007fff20502630, flags 0x9000630, shared, size 34:
          [ntdll.dll!RtlUserThreadStart]

With the fix:
  Fragment 1, tag 0x00007ffc25822630, flags 0x9000630, shared, size 34:
          [ntdll.dll!RtlUserThreadStart]

Issue: #4958, #626
Fixes #4958
Fixes #626
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant