linux-uconsole/arch
Vineet Gupta eb7b2163c2 ARC: signal handling robustify
commit e4140819da upstream.

A malicious signal handler / restorer can DOS the system by fudging the
user regs saved on stack, causing weird things such as sigreturn returning
to user mode PC but cpu state still being kernel mode....

Ensure that in sigreturn path status32 always has U bit; any other bogosity
(gargbage PC etc) will be taken care of by normal user mode exceptions mechanisms.

Reproducer signal handler:

    void handle_sig(int signo, siginfo_t *info, void *context)
    {
	ucontext_t *uc = context;
	struct user_regs_struct *regs = &(uc->uc_mcontext.regs);

	regs->scratch.status32 = 0;
    }

Before the fix, kernel would go off to weeds like below:

    --------->8-----------
    [ARCLinux]$ ./signal-test
    Path: /signal-test
    CPU: 0 PID: 61 Comm: signal-test Not tainted 4.0.0-rc5+ #65
    task: 8f177880 ti: 5ffe6000 task.ti: 8f15c000

    [ECR   ]: 0x00220200 => Invalid Write @ 0x00000010 by insn @ 0x00010698
    [EFA   ]: 0x00000010
    [BLINK ]: 0x2007c1ee
    [ERET  ]: 0x10698
    [STAT32]: 0x00000000 :                                   <--------
    BTA: 0x00010680	 SP: 0x5ffe7e48	 FP: 0x00000000
    LPS: 0x20003c6c	LPE: 0x20003c70	LPC: 0x00000000
    ...
    --------->8-----------

Reported-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-05-13 05:15:43 -07:00
..
alpha vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
arc ARC: signal handling robustify 2015-05-13 05:15:43 -07:00
arm ARM: dts: dove: Fix uart[23] reg property 2015-05-13 05:15:43 -07:00
arm64 arm64: kernel: compiling issue, need delete read_current_timer() 2015-05-06 21:56:25 +02:00
avr32 vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
blackfin blackfin updates for Linux 3.10 2013-05-10 07:21:16 -07:00
c6x C6x: time: Ensure consistency in __init 2015-05-06 21:56:28 +02:00
cris vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
frv vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
h8300 We get rid of the general module prefix confusion with a binary config option, 2013-05-05 10:58:06 -07:00
hexagon arch: mm: pass userspace fault flag to generic fault handler 2014-11-21 09:22:56 -08:00
ia64 vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
m32r vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
m68k vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
metag vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
microblaze vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
mips nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 21:56:28 +02:00
mn10300 vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
openrisc vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
parisc vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
powerpc nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 21:56:28 +02:00
s390 s390: Fix build error 2015-05-06 21:56:28 +02:00
score vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
sh nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 21:56:28 +02:00
sparc nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 21:56:28 +02:00
tile vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
um vm: add VM_FAULT_SIGSEGV handling support 2015-04-29 10:34:00 +02:00
unicore32 nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 21:56:28 +02:00
x86 nosave: consolidate __nosave_{begin,end} in <asm/sections.h> 2015-05-06 21:56:28 +02:00
xtensa xtensa: provide __NR_sync_file_range2 instead of __NR_sync_file_range 2015-05-06 21:56:26 +02:00
.gitignore
Kconfig microblaze: fix clone syscall 2013-08-20 08:43:02 -07:00