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

attach handling of signal arriving between handler being instated and takeover #1234

Open
derekbruening opened this issue Nov 28, 2014 · 3 comments

Comments

@derekbruening
Copy link
Contributor

From bruen...@google.com on July 29, 2013 18:20:12

For attaching and taking over existing threads, there will always be a race
between installing our signal handler and sending the suspend signal to
each target native thread. We need to handle app signals received in a
native thread during this window.

If delayable, we can queue them up -- if our queue heap is set up.

If an itimer, we could just drop the signal.

If un-delayable, we may need to copy to the app's signal stack and
implement a go-native path to the app handler.

Xref issue #26 , issue #359 , issue #777 , which I believe cover different time windows
(pre-dcontext-setup).

Xref loosely related issue #150 .

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

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on August 05, 2013 10:14:15

xref issue #1242

@derekbruening
Copy link
Contributor Author

From p...@google.com on August 05, 2013 10:40:00

What is the actual race condition? E.g. are there some steps that cannot be performed atomically (e.g. changing FS/GS base, calling sigaction) that, if a signal arrives in-between, result in inconsistent state?

@derekbruening
Copy link
Contributor Author

From bruen...@google.com on August 05, 2013 12:58:54

We need to install our signal handler before we send the suspend signal to each thread. So we have to first call sigaction and then loop through the threads and send each one a signal. Some other signal can arrive between the sigaction and the arrival of our suspend signal. If it arrives, we haven't yet initialized that thread. (In addition to the above actions, an alternative could be to initialize on any signal and wait for the resume -- though it's perhaps not so different from queuing it.) In practice, in our code the sigaction and the send of the suspend signal are separated by quite a bit of initialization code, IIRC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant