public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Was: ssetmask/sgetmask syscalls
       [not found] ` <1757046472.8555813.1357378462241.JavaMail.root@redhat.com>
@ 2013-01-05 18:12   ` Oleg Nesterov
  2013-01-05 18:13     ` [PATCH 1/2] signals: sys_ssetmask() uses uninitialized newmask Oleg Nesterov
  2013-01-05 18:13     ` [PATCH 2/2] signals: set_current_blocked() can use __set_current_blocked() Oleg Nesterov
  0 siblings, 2 replies; 4+ messages in thread
From: Oleg Nesterov @ 2013-01-05 18:12 UTC (permalink / raw)
  To: CAI Qian, Andrew Morton, Linus Torvalds
  Cc: Linda Wang, Matt Zywusko, Al Viro, linux-kernel

On 01/05, CAI Qian wrote:
>
> 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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] signals: sys_ssetmask() uses uninitialized newmask
  2013-01-05 18:12   ` [PATCH 0/2] Was: ssetmask/sgetmask syscalls Oleg Nesterov
@ 2013-01-05 18:13     ` Oleg Nesterov
  2013-01-06  3:28       ` CAI Qian
  2013-01-05 18:13     ` [PATCH 2/2] signals: set_current_blocked() can use __set_current_blocked() Oleg Nesterov
  1 sibling, 1 reply; 4+ messages in thread
From: Oleg Nesterov @ 2013-01-05 18:13 UTC (permalink / raw)
  To: CAI Qian, Andrew Morton, Linus Torvalds
  Cc: Linda Wang, Matt Zywusko, Al Viro, linux-kernel

77097ae5 "most of set_current_blocked() callers want SIGKILL/SIGSTOP
removed from set" removed the initialization of newmask by accident,
restore.

Reported-by: CAI Qian <caiqian@redhat.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: stable@kernel.org	# v3.5+
---
 kernel/signal.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 7aaa51d..9692499 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] signals: set_current_blocked() can use __set_current_blocked()
  2013-01-05 18:12   ` [PATCH 0/2] Was: ssetmask/sgetmask syscalls Oleg Nesterov
  2013-01-05 18:13     ` [PATCH 1/2] signals: sys_ssetmask() uses uninitialized newmask Oleg Nesterov
@ 2013-01-05 18:13     ` Oleg Nesterov
  1 sibling, 0 replies; 4+ messages in thread
From: Oleg Nesterov @ 2013-01-05 18:13 UTC (permalink / raw)
  To: CAI Qian, Andrew Morton, Linus Torvalds
  Cc: Linda Wang, Matt Zywusko, Al Viro, linux-kernel

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.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
 kernel/signal.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 9692499..372771e 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -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) {
-- 
1.5.5.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] signals: sys_ssetmask() uses uninitialized newmask
  2013-01-05 18:13     ` [PATCH 1/2] signals: sys_ssetmask() uses uninitialized newmask Oleg Nesterov
@ 2013-01-06  3:28       ` CAI Qian
  0 siblings, 0 replies; 4+ messages in thread
From: CAI Qian @ 2013-01-06  3:28 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Linda Wang, Matt Zywusko, Al Viro, linux-kernel, Andrew Morton,
	Linus Torvalds



----- Original Message -----
> From: "Oleg Nesterov" <oleg@redhat.com>
> To: "CAI Qian" <caiqian@redhat.com>, "Andrew Morton" <akpm@linux-foundation.org>, "Linus Torvalds"
> <torvalds@linux-foundation.org>
> Cc: "Linda Wang" <lwang@redhat.com>, "Matt Zywusko" <mzywusko@redhat.com>, "Al Viro" <viro@zeniv.linux.org.uk>,
> linux-kernel@vger.kernel.org
> Sent: Sunday, January 6, 2013 2:13:13 AM
> Subject: [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.
> 
> Reported-by: CAI Qian <caiqian@redhat.com>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
> Cc: stable@kernel.org	# v3.5+
Thanks Oleg. This is now passing the testing.

Tested-by: CAI Qian <caiqian@redhat.com>
> ---
>  kernel/signal.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/kernel/signal.c b/kernel/signal.c
> index 7aaa51d..9692499 100644
> --- a/kernel/signal.c
> +++ b/kernel/signal.c
> @@ -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
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-01-06  3:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <688203485.8555438.1357377797739.JavaMail.root@redhat.com>
     [not found] ` <1757046472.8555813.1357378462241.JavaMail.root@redhat.com>
2013-01-05 18:12   ` [PATCH 0/2] Was: ssetmask/sgetmask syscalls Oleg Nesterov
2013-01-05 18:13     ` [PATCH 1/2] signals: sys_ssetmask() uses uninitialized newmask Oleg Nesterov
2013-01-06  3:28       ` CAI Qian
2013-01-05 18:13     ` [PATCH 2/2] signals: set_current_blocked() can use __set_current_blocked() Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox