linux_dsm_epyc7002/arch/arc/kernel
Vineet Gupta e4140819da ARC: signal handling robustify
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>
Cc: <stable@vger.kernel.org>
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
2015-03-26 11:19:36 +05:30
..
.gitignore ARC: Add some .gitignore entries 2013-08-26 09:40:24 +05:30
arc_hostlink.c ARC: Hostlink Pseudo-Driver for Metaware Debugger 2013-02-15 23:16:10 +05:30
arcksyms.c ARC: Build system: Makefiles, Kconfig, Linker script 2013-02-11 20:00:25 +05:30
asm-offsets.c ARC: pt_regs update #5: Use real ECR for pt_regs->event vs. synth values 2013-06-26 14:04:48 +05:30
clk.c ARC: fix typo with clock speed 2013-05-07 13:43:54 +05:30
ctx_sw_asm.S ARC: Fix build breakage for !CONFIG_ARC_DW2_UNWIND 2014-06-26 10:14:02 +05:30
ctx_sw.c ARC: [SMP] Fix build failures for large NR_CPUS 2013-11-06 10:41:46 +05:30
devtree.c ARC: Fix earlycon build breakage 2015-02-04 10:38:15 +05:30
disasm.c ARC: rename kconfig option for unaligned emulation 2014-10-13 14:46:15 +05:30
entry.S ARC: add some more comments to ret_from_fork 2015-02-02 17:08:37 +05:30
fpu.c ARC: Process-creation/scheduling/idle-loop 2013-02-11 20:00:38 +05:30
head.S ARC: RIP @running_on_hw 2014-10-13 14:46:17 +05:30
irq.c ARC: [intc] mask/unmask can be hidden again 2014-07-23 11:22:02 +05:30
kgdb.c ARC: kgdb: generic kgdb_arch_pc() suffices 2014-10-22 16:14:04 -06:00
kprobes.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-11-15 16:47:22 -08:00
Makefile ARC: rename kconfig option for unaligned emulation 2014-10-13 14:46:15 +05:30
module.c ARC: Fix coding style issues 2013-04-09 12:21:14 +05:30
perf_event.c ARC: boot: cpu feature print enhancements 2014-10-13 14:46:22 +05:30
process.c ARC: Fix thread_saved_pc() 2015-02-27 10:59:34 +05:30
ptrace.c ARC: Implement ptrace(PTRACE_GET_THREAD_AREA) 2014-06-26 10:14:08 +05:30
reset.c arc: export symbol for pm_power_off in reset.c 2013-11-06 10:41:44 +05:30
setup.c ARC: fix /proc/cpuinfo for offline cpus 2015-02-02 17:08:37 +05:30
signal.c ARC: signal handling robustify 2015-03-26 11:19:36 +05:30
smp.c ARC: use ACCESS_ONCE in cmpxchg loop 2015-02-02 17:08:37 +05:30
stacktrace.c ARC: Fix KSTK_ESP() 2015-02-27 10:48:23 +05:30
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: update some comments 2014-07-23 11:17:12 +05:30
traps.c ARC: Reduce #ifdef'ery for unaligned access emulation 2013-11-06 10:41:39 +05:30
troubleshoot.c arc: call find_vma with the mmap_sem held 2014-06-04 16:54:00 -07:00
unaligned.c ARC: perf: Enable generic software events 2015-02-27 10:15:01 +05:30
unwind.c ARC: warn on improper stack unwind FDE entries 2013-06-27 14:37:59 +05:30
vmlinux.lds.S ARC: optimize kernel bss clearing in early boot code 2014-06-26 10:14:05 +05:30