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

ASSERT: core/unix/signal.c:493 rc == 0: dr_app_start fail on sigaltstack_syscall #2016

Closed
zhaoqin opened this issue Oct 11, 2016 · 2 comments

Comments

@zhaoqin
Copy link
Contributor

zhaoqin commented Oct 11, 2016

An assert failure is seen on DynamoRIO trying to take over a multi-threaded application using dr_app_start.
Internal Error: DynamoRIO debug check failure: core/unix/signal.c:493 rc == 0

It happens if a thread has already setup the signal stack, and DR tries to take it over in the signal handler. In that case, the sigaltstack_syscall fails and returns -1, ([EPERM] An attempt was made to modify an active stack).

(gdb) p/x $rsp
$9 = 0x7ffff6e4a2d0
(gdb) p/x *newstack
$10 = {ss_sp = 0x54c1d000, ss_flags = 0x0, ss_size = 0xe000}
(gdb) p/x *oldstack
$11 = {ss_sp = 0x0, ss_flags = 0x0, ss_size = 0x0}
@derekbruening
Copy link
Contributor

Clearly we need to add a delayed-takeover test that uses signals and sigaltstack.

2 solutions come to mind:

  1. Don't set SA_ONSTACK but then reinstate after takeover init: feels slightly risky but if reinstating is before any swap then we're just assuming orig app stack which we're doing anyway.

  2. Swap stacks either temporarily in takeover-init, or make the dstack early like some clone handling paths do and swap early -- though this will complicate the app state snapshot.

@derekbruening
Copy link
Contributor

derekbruening commented Oct 11, 2016

Xref #722
Xref #2018
Xref #1921

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

2 participants