Handle TIF_RESTORE_SIGMASK for i386
Quoted 7 lines · David Woodhouse
The attached patch handles
TIF_RESTORE_SIGMASKas added by David Woodhouse's patch entitled:[PATCH] 2/3 Add
TIF_RESTORE_SIGMASKsupport forarch/powerpc[PATCH] 3/3 Genericsys_rt_sigsuspend
Quoted 8 lines
It does the following:
(1) Declares
TIF_RESTORE_SIGMASKfor i386.(2) Invokes it over to
do_signal()whenTIF_RESTORE_SIGMASKis set.(3) Makes
do_signal()supportTIF_RESTORE_SIGMASK, using the signal mask savedin current->saved_sigmask.
Imho, there is a slightly better way to do it, see the patch below.
Instead of adding TIF_RESTORE_SIGMASK we can introduce ERESTART_SIGBLOCK return value. Now,
sys_rt_sigsuspend(sigset_t *newset)
{
current->saved_sigmask = current->blocked;
current->blocked = newset;
current->state = TASK_INTERRUPTIBLE;
schedule();
return -ERESTART_SIGBLOCK;
}sys_pselect()
{
...
ret = core_sys_select();
if (ret == -ERESTARTNOHAND)
ret = -ERESTART_SIGBLOCK;
}handle_signal()
{
sigset_t *oldset; // removed from param list
...
oldset = ¤t->blocked;
if (regs->eax == -ERESTART_SIGBLOCK)
oldset = ¤t->saved_sigmask;
...
}Comments?
Only for illustration, but seems to work.
include/linux/errno.h | 1 include/linux/sched.h | 2 - include/asm-i386/signal.h | 3 - arch/i386/kernel/signal.c | 73 +++++++++++++++++++++------------------------- 4 files changed, 36 insertions(+), 43 deletions(-)
include/linux/errno.h renamed from include/linux/errno.h~1_SIGM +1 -0
@@ -11,6 +11,7 @@#define ERESTARTNOHAND 514/* restart if no handler.. */ #define ENOIOCTLCMD 515/* No ioctl command */ #define ERESTART_RESTARTBLOCK 516/* restart by calling sys_restart_syscall */ +#define ERESTART_SIGBLOCK 517/* Defined for the NFSv3 protocol */ #define EBADHANDLE 521/* Illegal NFS file handle */
include/linux/sched.h renamed from include/linux/sched.h~1_SIGM +1 -1
@@ -799,7 +799,7 @@ struct task_struct {struct signal_struct *signal;struct sighand_struct *sighand; -sigset_t blocked, real_blocked; +sigset_t blocked, real_blocked, saved_blocked;struct sigpending pending;unsigned long sas_ss_sp;
include/asm-i386/signal.h renamed from include/asm-i386/signal.h~1_SIGM +0 -3
@@ -217,9 +217,6 @@ static __inline__ int sigfindinword(unsireturn word; } -struct pt_regs ; -extern int FASTCALL (do_signal (struct pt_regs *regs,sigset_t *oldset)); -#define ptrace_signal_deliver (regs, cookie) \ do { \ if (current->ptrace & PT_DTRACE) { \
arch/i386/kernel/signal.c renamed from arch/i386/kernel/signal.c~1_SIGM +34 -39
162 lines not on this page · raw message