Skip to contentSkip to conversation

Was: ssetmask/sgetmask syscalls

PATCH In review Oleg Nesterov 2 participants 4 messages Jan 5, 2013 – Jan 6, 2013 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

cover Was: ssetmask/sgetmask syscalls

Quoted 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.

#3 lore raw

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
index 7aaa51d..9692499 100644
@@ -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
Tested-by on v1 1/2
#4 lore raw

Re: [PATCH 1/2] signals: sys_ssetmask() uses uninitialized newmask

----- 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 of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set" removed the initialization of newmask by accident, restore.

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
index 7aaa51d..9692499 100644
@@ -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

#5 lore raw

PATCH 2/2 signals: set_current_blocked() can use __set_current_blocked()

In reply to Oleg Nesterov

Cleanup. 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
index 9692499..372771e 100644
@@ -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