public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] compat: Fix RT signal mask corruption via sigprocmask
@ 2012-05-09 22:09 Jan Kiszka
  2012-05-09 22:09 ` Jan Kiszka
  2012-05-10  0:00 ` Linus Torvalds
  0 siblings, 2 replies; 9+ messages in thread
From: Jan Kiszka @ 2012-05-09 22:09 UTC (permalink / raw)
  To: Linux Kernel Mailing List, linux-arch
  Cc: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Linus Torvalds,
	Andrew Morton, Michael Tokarev, Anthony Liguori, Kevin Wolf

compat_sys_sigprocmask reads a smaller signal mask from userspace than
sigprogmask accepts for setting. So the high word of blocked.sig[0] will
be cleared, releasing any potentially blocked RT signal.

This was discovered via userspace code that relies on get/setcontext.
glibc's i386 versions of those functions use sigprogmask instead of
rt_sigprogmask to save/restore the signal mask and caused RT signal
unblocking this way.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 kernel/compat.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/compat.c b/kernel/compat.c
index 74ff849..03e491d 100644
--- a/kernel/compat.c
+++ b/kernel/compat.c
@@ -381,6 +381,8 @@ asmlinkage long compat_sys_sigprocmask(int how, compat_old_sigset_t __user *set,
 
 	if (set && get_user(s, set))
 		return -EFAULT;
+	s |= current->blocked.sig[0] &
+		~((old_sigset_t)(compat_old_sigset_t)-1);
 	old_fs = get_fs();
 	set_fs(KERNEL_DS);
 	ret = sys_sigprocmask(how,
-- 
1.7.3.4

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

end of thread, other threads:[~2012-05-10 18:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-09 22:09 [PATCH] compat: Fix RT signal mask corruption via sigprocmask Jan Kiszka
2012-05-09 22:09 ` Jan Kiszka
2012-05-10  0:00 ` Linus Torvalds
2012-05-10 13:04   ` [PATCH v2] " Jan Kiszka
2012-05-10 13:04     ` Jan Kiszka
2012-05-10 15:44     ` Linus Torvalds
2012-05-10 15:58       ` Linus Torvalds
2012-05-10 17:38         ` Jan Kiszka
2012-05-10 18:51         ` Michael Tokarev

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