]> granicus.if.org Git - strace/commit
Get rid of TCB_SIGTRAPPED
authorDenys Vlasenko <dvlasenk@redhat.com>
Wed, 18 Jan 2012 15:30:47 +0000 (16:30 +0100)
committerDenys Vlasenko <dvlasenk@redhat.com>
Wed, 18 Jan 2012 15:30:47 +0000 (16:30 +0100)
commit023b7700de942f59fcb4cd30903969d276a4d796
tree4c941e2a8bd47ef25b2db2f45d042ce2c4f63def
parent5e09d77500a656da343580a16e6d005eb1c560b1
Get rid of TCB_SIGTRAPPED

On attempts to block or set SIGTRAP handler,
for example, using sigaction syscall, we generate
an additional SIGSTOP.

This change gets rid of this SIGSTOP sending/ignoring.
It appears to work just fine.

It also works if I force strace to not use PTRACE_O_TRACESYSGOOD,
which means strace stops will be marked with SIGTRAP,
not (SIGTRAP | 0x80) - I wondered maybe that's when
this hack is needed.

So, why we even have TCB_SIGTRAPPED? No one knows. It predates
version control: this code was present in the initial commit,
in 1999. No adequate comments, either.

Moreover, TCB_SIGTRAPPED is not set in sys_rt_sigaction
and sys_sigprocmask syscalls - the ones which are most usually
used to implement signal blocking, it is only set in obsolete
sys_signal, sys_sigaction, sys_sigsetmask, and in some dead
non-Linux code.

I think whatever bug it was fixing is gone long ago -
at least as long as sys_rt_sigaction is used by glibc.
Again, since glibc (and uclibc) uses sys_rt_sigaction
and sys_sigprocmask, modified code paths are not used
by most programs anyway.

* defs.h: Remove definition of TCB_SIGTRAPPED.
* signal.c (sys_sigvec): Don't set TCB_SIGTRAPPED and don't send SIGSTOP.
(sys_sigsetmask): Likewise.
(sys_sigaction): Likewise.
(sys_signal): Likewise.
* strace.c (trace): Remove code which executes if TCB_SIGTRAPPED is set.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
defs.h
signal.c
strace.c