All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] information leak in sigaltstack
@ 2009-07-31 19:48 Ulrich Drepper
  2009-07-31 21:15 ` Linus Torvalds
  0 siblings, 1 reply; 8+ messages in thread
From: Ulrich Drepper @ 2009-07-31 19:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, torvalds

Unfortunately the stack_t data structure was defined before people
cared much about 64-bit architectures.  It has a hole in the middle.
And this hole is creating an information leak in the sigaltstack
syscall.

When the second parameter to sigaltstack is non-NULL the current stack
information is passed to the caller by filling in the members of the
stack_t structure and then the whole structure is copied using
copy_to_user.  This unfortunately leaves the whole after flags
uninitialized.

The following patch should fix the issue.

Signed-off-by: Ulrich Drepper <drepper@redhat.com>


diff --git a/kernel/signal.c b/kernel/signal.c
index ccf1cee..612d6b7 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2455,6 +2455,9 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
 	int error;
 
 	if (uoss) {
+		if (offsetof(stack_t, ss_flags) + sizeof(oss.ss_flags) !=
+		    offsetof(stack_t, ss_size))
+			memset(&oss, '\0', sizeof(oss));
 		oss.ss_sp = (void __user *) current->sas_ss_sp;
 		oss.ss_size = current->sas_ss_size;
 		oss.ss_flags = sas_ss_flags(sp);

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

end of thread, other threads:[~2009-08-01 17:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-31 19:48 [PATCH] information leak in sigaltstack Ulrich Drepper
2009-07-31 21:15 ` Linus Torvalds
2009-07-31 21:31   ` Linus Torvalds
2009-07-31 21:37     ` Ulrich Drepper
2009-08-01  0:28       ` Linus Torvalds
2009-08-01  7:22         ` Jakub Jelinek
2009-08-01 16:13           ` Linus Torvalds
2009-08-01 17:52         ` Linus Torvalds

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.