]> granicus.if.org Git - strace/commit
Display mask on enter to sigreturn, not on exit
authorDenys Vlasenko <dvlasenk@redhat.com>
Tue, 10 Jan 2012 15:40:35 +0000 (16:40 +0100)
committerDenys Vlasenko <dvlasenk@redhat.com>
Tue, 10 Jan 2012 15:40:35 +0000 (16:40 +0100)
commitb11322fd3c8d291061d69e40e28004b97b91b15d
tree25530b17b534cb1b01d88d9548e80216b0153835
parentf1e690370359f61f9533134817b52d74460a20fb
Display mask on enter to sigreturn, not on exit

sys_sigreturn() performs ugly manipulations in order to show
signal mask which is restored by this syscall: on syscall entry,
fetches it from the stack, saves it in tcp->u_arg[]
(where it used to overflow this array - fixed sometime ago),
then retrieves the mask and displays it on syscall exit.

Apparently, the motivation is to make it slightly more obvious
to user that signal mask is restored only when this syscall returns.
IMO, this hardly justifies the necessary hacks. It is much easier
to display the mask at the point when we fetch it - on syscall entry.

While at it, I made it so that we do display returned value/errno.
I see no point in hiding it and showing uninformative "= ?" instead.

Example of pause() being interrupted by ALRM which has installed handler
which re-arms ALRM:

Before the patch:

rt_sigsuspend([INT])                    = ? ERESTARTNOHAND (To be restarted)
--- {si_signo=SIGALRM, si_code=SI_KERNEL} (Alarm clock) ---
alarm(1)                                = 0
sigreturn()                             = ? (mask now [INT])

After:

rt_sigsuspend([INT])                    = ? ERESTARTNOHAND (To be restarted)
--- {si_signo=SIGALRM, si_code=SI_KERNEL} (Alarm clock) ---
alarm(1)                                = 0
sigreturn() (mask [INT])                = -1 EINTR (Interrupted system call)

* defs.h: Declare struct pt_regs i386_regs and struct pt_regs x86_64_regs.
* syscall.c: Remove "static" keywork from these structures' definitions.
* signal.c (sys_sigreturn): Display mask on enter, not on exit.

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