Was: ssetmask/sgetmask syscalls
cover Was: ssetmask/sgetmask syscalls
In reply to a message not in the archiveQuoted 5 lines · CAI Qian
FYI, I noticed that ssetmask/sgetmask syscalls starting to fail
ssetmask01 1 TFAIL :
sgetmask()failed: TEST_ERRNO=???(0): Success
Thanks!
Should be fixed by 1/2. Probably trivial enough for 3.8
2/2 is a minor "while at it" cleanup.
Oleg.
PATCH 1/2 signals: sys_ssetmask() uses uninitialized newmask
77097ae5 "most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set" removed the initialization of newmask by accident, restore.
--- kernel/signal.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/signal.c +1 -0
@@ -3286,6 +3286,7 @@ SYSCALL_DEFINE1(ssetmask, int, newmask)int old = current->blocked.sig[0 ];sigset_t newset; +siginitset (&newset, newmask);set_current_blocked (&newset);return old;
Signature · 1 line
1.5.5.1
PATCH 2/2 signals: set_current_blocked() can use __set_current_blocked()
In reply to Oleg NesterovCleanup. And I think we need more cleanups, in particular __set_current_blocked() and sigprocmask() should die. Nobody should ever block SIGKILL or SIGSTOP.
- Change set_current_blocked() to use __set_current_blocked()
- Change sys_sigprocmask() to use set_current_blocked(), this way it should not worry about SIGKILL/SIGSTOP.
--- kernel/signal.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
kernel/signal.c +2 -6
@@ -2528,11 +2528,8 @@ static void __set_task_blocked(struct task_struct *tsk, const sigset_t *newset)*/ void set_current_blocked (sigset_t *newset) { -struct task_struct *tsk = current;sigdelsetmask (newset,sigmask (SIGKILL ) |sigmask (SIGSTOP )); -spin_lock_irq (&tsk->sighand->siglock); -__set_task_blocked (tsk, newset); -spin_unlock_irq (&tsk->sighand->siglock); +__set_current_blocked (newset); }void __set_current_blocked (const sigset_t *newset)
@@ -3204,7 +3201,6 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,if (nset) {if (copy_from_user (&new_set, nset,sizeof (*nset)))return -EFAULT ; - new_set &= ~(sigmask (SIGKILL ) |sigmask (SIGSTOP )); new_blocked = current->blocked;
@@ -3222,7 +3218,7 @@ SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, nset,return -EINVAL ; } -__set_current_blocked (&new_blocked); +set_current_blocked (&new_blocked); }if (oset) {
Signature · 1 line
1.5.5.1
Re: [PATCH 1/2] signals: sys_ssetmask() uses uninitialized newmask
In reply to Oleg Nesterov----- Original Message -----
Quoted 8 lines
From: "Oleg Nesterov" <[email protected]>
To: "CAI Qian" <[email protected]>, "Andrew Morton" <[email protected]>, "Linus Torvalds" <[email protected]>
Cc: "Linda Wang" <[email protected]>, "Matt Zywusko" <[email protected]>, "Al Viro" <[email protected]>, [email protected]
Sent: Sunday, January 6, 2013 2:13:13 AM
Subject: [PATCH 1/2] signals:sys_ssetmask()uses uninitialized newmask
Quoted 7 lines
77097ae5"most ofset_current_blocked()callers want SIGKILL/SIGSTOP removed from set" removed the initialization of newmask by accident, restore.Reported-by CAI Qian <[email protected]>Signed-off-by Oleg Nesterov <[email protected]>Cc [email protected] # v3.5+
Thanks Oleg. This is now passing the testing.
Quoted 21 lines
--- kernel/signal.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)kernel/signal.c +1
-1@@ -3286,6 +3286,7 @@ SYSCALL_DEFINE1(ssetmask, int, newmask)int old = current->blocked.sig[0 ];sigset_t newset; +siginitset (&newset, newmask);set_current_blocked (&newset);return old; --1.5.5.1