summaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm/sigcontext.h
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@amacapital.net>2015-03-12 13:57:51 -0700
committerIngo Molnar <mingo@kernel.org>2015-03-17 09:25:25 +0100
commitc6f2062935c8fcb31235799eaee8bcd5b649936b (patch)
tree475bd9963438b644df6e47cf1c4eeaebacff7496 /arch/x86/include/asm/sigcontext.h
parent263042e4630a85e856b4a8cd72f28dab33ef4741 (diff)
downloadlinux-0-day-c6f2062935c8fcb31235799eaee8bcd5b649936b.tar.gz
linux-0-day-c6f2062935c8fcb31235799eaee8bcd5b649936b.tar.xz
x86/signal/64: Fix SS handling for signals delivered to 64-bit programs
The comment in the signal code says that apps can save/restore other segments on their own. It's true that apps can *save* SS on their own, but there's no way for apps to restore it: SYSCALL effectively resets SS to __USER_DS, so any value that user code tries to load into SS gets lost on entry to sigreturn. This recycles two padding bytes in the segment selector area for SS. While we're at it, we need a second change to make this useful. If the signal we're delivering is caused by a bad SS value, saving that value isn't enough. We need to remove that bad value from the regs before we try to deliver the signal. Oddly, the i386 code already got this right. I suspect that 64-bit programs that try to run 16-bit code and use signals will have a lot of trouble without this. Signed-off-by: Andy Lutomirski <luto@amacapital.net> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Borislav Petkov <bp@suse.de> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/405594361340a2ec32f8e2b115c142df0e180d8e.1426193719.git.luto@kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/include/asm/sigcontext.h')
-rw-r--r--arch/x86/include/asm/sigcontext.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/include/asm/sigcontext.h b/arch/x86/include/asm/sigcontext.h
index 9dfce4e0417d9..f910cdcb71fde 100644
--- a/arch/x86/include/asm/sigcontext.h
+++ b/arch/x86/include/asm/sigcontext.h
@@ -59,7 +59,7 @@ struct sigcontext {
unsigned short cs;
unsigned short gs;
unsigned short fs;
- unsigned short __pad0;
+ unsigned short ss;
unsigned long err;
unsigned long trapno;
unsigned long oldmask;