linux/arch/sh/kernel
Andy Lutomirski f56141e3e2 all arches, signal: move restart_block to struct task_struct
If an attacker can cause a controlled kernel stack overflow, overwriting
the restart block is a very juicy exploit target.  This is because the
restart_block is held in the same memory allocation as the kernel stack.

Moving the restart block to struct task_struct prevents this exploit by
making the restart_block harder to locate.

Note that there are other fields in thread_info that are also easy
targets, at least on some architectures.

It's also a decent simplification, since the restart code is more or less
identical on all architectures.

[james.hogan@imgtec.com: metag: align thread_info::supervisor_stack]
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Kees Cook <keescook@chromium.org>
Cc: David Miller <davem@davemloft.net>
Acked-by: Richard Weinberger <richard@nod.at>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Haavard Skinnemoen <hskinnemoen@gmail.com>
Cc: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Cc: Steven Miao <realmz6@gmail.com>
Cc: Mark Salter <msalter@redhat.com>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Tested-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Chen Liqin <liqin.linux@gmail.com>
Cc: Lennox Wu <lennox.wu@gmail.com>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-02-12 18:54:12 -08:00
..
cpu cpuidle: Invert CPUIDLE_FLAG_TIME_VALID logic 2014-11-12 21:17:27 +01:00
vsyscall arm64,ia64,ppc,s390,sh,tile,um,x86,mm: remove default gate area 2014-08-08 15:57:27 -07:00
.gitignore
asm-offsets.c all arches, signal: move restart_block to struct task_struct 2015-02-12 18:54:12 -08:00
crash_dump.c
debugtraps.S
disassemble.c
dma-nommu.c
dumpstack.c sh: fix format string bug in stack tracer 2014-04-03 16:20:49 -07:00
dwarf.c arch/sh/kernel/dwarf.c: use rbtree postorder iteration helper instead of solution using repeated rb_erase() 2014-01-23 16:37:03 -08:00
entry-common.S sh: push extra copy of r0-r2 for syscall parameters 2014-04-03 16:20:52 -07:00
ftrace.c sh: ftrace: Add call to ftrace_graph_is_dead() in function graph code 2014-07-18 13:56:57 -04:00
head_32.S
head_64.S
hw_breakpoint.c sh: Replace __get_cpu_var uses 2014-06-04 16:53:52 -07:00
idle.c sched/idle, SH: Remove redundant cpuidle_idle_call() 2014-02-11 09:58:26 +01:00
io.c
io_trapped.c Kconfig: rename HAS_IOPORT to HAS_IOPORT_MAP 2014-04-07 16:36:11 -07:00
iomap.c
ioport.c sections: fix section conflicts in arch/sh 2012-10-06 03:04:40 +09:00
irq.c sh: Use irq_set_affinity instead of homebrewn code 2014-03-04 17:37:55 +01:00
irq_32.c
irq_64.c
kdebugfs.c
kgdb.c arch/sh/kernel/kgdb.c: add missing #include <linux/sched.h> 2014-01-21 16:19:42 -08:00
kprobes.c sh: Replace __get_cpu_var uses 2014-06-04 16:53:52 -07:00
localtimer.c sh: Replace __get_cpu_var uses 2014-06-04 16:53:52 -07:00
machine_kexec.c
machvec.c
Makefile Kconfig: rename HAS_IOPORT to HAS_IOPORT_MAP 2014-04-07 16:36:11 -07:00
module.c
nmi_debug.c
perf_callchain.c
perf_event.c sh, perf: Use common PMU interrupt disabled code 2014-06-19 19:37:51 +02:00
process.c sh: delete __cpuinit usage from all sh files 2013-07-14 19:36:53 -04:00
process_32.c sh: move fpu_counter into ARCH specific thread_struct 2013-11-13 12:09:13 +09:00
process_64.c sh64: kernel: remove useless variable 'regs' 2013-11-13 12:08:59 +09:00
ptrace.c
ptrace_32.c ARCH: AUDIT: audit_syscall_entry() should not require the arch 2014-09-23 16:21:26 -04:00
ptrace_64.c ARCH: AUDIT: audit_syscall_entry() should not require the arch 2014-09-23 16:21:26 -04:00
reboot.c
relocate_kernel.S
return_address.c
setup.c memblock: make memblock_set_node() support different memblock_type 2014-01-21 16:19:44 -08:00
sh_bios.c early_printk: consolidate random copies of identical code 2013-04-29 18:28:13 -07:00
sh_ksyms_32.c sh: add EXPORT_SYMBOL(min_low_pfn) and EXPORT_SYMBOL(max_low_pfn) to sh_ksyms_32.c 2014-01-02 14:40:30 -08:00
sh_ksyms_64.c sh: use the new generic strnlen_user() function 2012-06-13 10:28:37 +09:00
signal_32.c all arches, signal: move restart_block to struct task_struct 2015-02-12 18:54:12 -08:00
signal_64.c all arches, signal: move restart_block to struct task_struct 2015-02-12 18:54:12 -08:00
smp.c sh: Replace __get_cpu_var uses 2014-06-04 16:53:52 -07:00
stacktrace.c
swsusp.c
sys_sh.c
sys_sh32.c sh: push extra copy of r0-r2 for syscall parameters 2014-04-03 16:20:52 -07:00
syscalls_32.S sh: wire up finit_module syscall. 2013-01-14 17:59:03 +09:00
syscalls_64.S sh: wire up finit_module syscall. 2013-01-14 17:59:03 +09:00
time.c arch/sh/kernel/time.c: use PTR_ERR_OR_ZERO 2014-08-06 18:01:12 -07:00
topology.c
traps.c taint: add explicit flag to show whether lock dep is still OK. 2013-01-21 17:17:57 +10:30
traps_32.c sh: don't pass saved userspace state to exception handlers 2014-04-03 16:20:52 -07:00
traps_64.c sh: delete __cpuinit usage from all sh files 2013-07-14 19:36:53 -04:00
unwinder.c
vmlinux.lds.S mtd/uclinux: Use generic __bss_stop instead of _ebss 2012-06-27 09:59:43 +02:00