linux-uconsole/arch/arc/kernel
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
..
arc_hostlink.c ARC: Hostlink Pseudo-Driver for Metaware Debugger 2013-02-15 23:16:10 +05:30
arcksyms.c
asm-offsets.c ARC: Use <linux/*> headers instead of <asm/*> 2013-04-09 12:21:14 +05:30
clk.c ARC: fix typo with clock speed 2013-05-07 13:43:54 +05:30
ctx_sw.c ARC: SMP support 2013-02-15 23:16:02 +05:30
ctx_sw_asm.S ARC: Process-creation/scheduling/idle-loop 2013-02-11 20:00:38 +05:30
devtree.c ARC: make a copy of flat DT 2013-02-26 14:25:18 +05:30
disasm.c ARC port updates for Linux 3.10 (part 1) 2013-05-09 14:36:27 -07:00
entry.S ARC: !PREEMPT: Ensure Return to kernel mode is IRQ safe 2014-05-13 13:59:46 +02:00
fpu.c ARC: Process-creation/scheduling/idle-loop 2013-02-11 20:00:38 +05:30
head.S ARC: SMP failed to boot due to missing IVT setup 2013-10-18 07:45:45 -07:00
irq.c ARC: SMP failed to boot due to missing IVT setup 2013-10-18 07:45:45 -07:00
kgdb.c ARC: make allyesconfig build breakages 2013-03-11 19:01:09 +05:30
kprobes.c ARC: Remove duplicate inclusion of header files 2013-04-09 12:21:15 +05:30
Makefile ARC: Hostlink Pseudo-Driver for Metaware Debugger 2013-02-15 23:16:10 +05:30
module.c ARC: Fix coding style issues 2013-04-09 12:21:14 +05:30
process.c arc: Use generic idle loop 2013-04-08 17:39:23 +02:00
ptrace.c ARC: Implement ptrace(PTRACE_GET_THREAD_AREA) 2014-07-28 08:00:07 -07:00
reset.c ARC: Boot #1: low-level, setup_arch(), /proc/cpuinfo, mem init 2013-02-15 23:15:54 +05:30
setup.c ARC: SMP failed to boot due to missing IVT setup 2013-10-18 07:45:45 -07:00
signal.c ARC: signal handling robustify 2015-05-13 05:15:43 -07:00
smp.c arc: Use generic idle loop 2013-04-08 17:39:23 +02:00
stacktrace.c dump_stack: consolidate dump_stack() implementations and unify their behaviors 2013-04-30 17:04:02 -07:00
sys.c ARC: ABIv3: fork/vfork wrappers not needed in "no-legacy-syscall" ABI 2013-03-11 19:01:10 +05:30
time.c ARC: Remove duplicate inclusion of header files 2013-04-09 12:21:15 +05:30
traps.c ARC: unaligned access emulation error handling consolidation 2013-05-07 13:43:55 +05:30
troubleshoot.c ARC port updates for Linux 3.10 (part 1) 2013-05-09 14:36:27 -07:00
unaligned.c ARC: Handle zero-overhead-loop in unaligned access handler 2013-10-18 07:45:45 -07:00
unwind.c ARC: DWARF2 .debug_frame based stack unwinder 2013-02-15 23:16:03 +05:30
vmlinux.lds.S ARC: [Review] Multi-platform image #4: Isolate platform headers 2013-02-15 23:16:14 +05:30