You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today, DR does not set SA_RESTART when it installs its own signal handlers,
regardless of what the app requested. Plus, it sends signals for its own
purposes that might interrupt a system call (SIGUSR1 for thread suspension;
SIGILL for nudges).
These two factors combine to mean that an app running under DR might have
different system call restart behavior than it would natively. The app might
use signal(), or use sigaction() with SA_RESTART, and expect something like
read() to be auto-restarted. Yet under DR the syscall will instead return
EINTR, which the app wouldn't expect in this case.
This is easily illustrated:
# cat eintr.c
#include <stdio.h>
int
main(int argc, char **argv)
{
char buf[16];
int res = read(stdin->_fileno, buf, 2);
if (res < 0)
perror("error during read");
else
printf("got %d %c\n", res, buf[0]);
return 0;
}
# gcc -o eintr eintr.c -g
# ./eintr
In another shell:
# kill -s SIGURG `pgrep eintr`
Natively, nothing happens and the app keeps waiting for input.
Under DR:
I picked SIGURG because its default behavior is ignore: I could pick a
default-terminate signal and have the app install a handler via signal() and
we'd have a similar effect:
From bruen...@google.com on April 16, 2013 14:52:00
Today, DR does not set SA_RESTART when it installs its own signal handlers,
regardless of what the app requested. Plus, it sends signals for its own
purposes that might interrupt a system call (SIGUSR1 for thread suspension;
SIGILL for nudges).
These two factors combine to mean that an app running under DR might have
different system call restart behavior than it would natively. The app might
use signal(), or use sigaction() with SA_RESTART, and expect something like
read() to be auto-restarted. Yet under DR the syscall will instead return
EINTR, which the app wouldn't expect in this case.
This is easily illustrated:
In another shell:
Natively, nothing happens and the app keeps waiting for input.
Under DR:
I picked SIGURG because its default behavior is ignore: I could pick a
default-terminate signal and have the app install a handler via signal() and
we'd have a similar effect:
Add to the app:
Natively:
DR:
Original issue: http://code.google.com/p/dynamorio/issues/detail?id=1145
The text was updated successfully, but these errors were encountered: