OSDN Git Service

s390: add no-execute support
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 22 Mar 2016 09:54:24 +0000 (10:54 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 8 Feb 2017 13:13:25 +0000 (14:13 +0100)
commit57d7f939e7bdd746992f5c318a78697ba837c523
tree80c01c9c446fc190432798a6d1ecf0c8e5456b57
parent2583b848cad049cf5f3f0a03af8b140668b376f3
s390: add no-execute support

Bit 0x100 of a page table, segment table of region table entry
can be used to disallow code execution for the virtual addresses
associated with the entry.

There is one tricky bit, the system call to return from a signal
is part of the signal frame written to the user stack. With a
non-executable stack this would stop working. To avoid breaking
things the protection fault handler checks the opcode that caused
the fault for 0x0a77 (sys_sigreturn) and 0x0aad (sys_rt_sigreturn)
and injects a system call. This is preferable to the alternative
solution with a stub function in the vdso because it works for
vdso=off and statically linked binaries as well.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 files changed:
arch/s390/include/asm/cacheflush.h
arch/s390/include/asm/pgtable.h
arch/s390/include/asm/setup.h
arch/s390/kernel/early.c
arch/s390/kernel/entry.S
arch/s390/kernel/kprobes.c
arch/s390/kernel/module.c
arch/s390/kernel/vmlinux.lds.S
arch/s390/mm/dump_pagetables.c
arch/s390/mm/fault.c
arch/s390/mm/hugetlbpage.c
arch/s390/mm/init.c
arch/s390/mm/pageattr.c
arch/s390/mm/pgtable.c
arch/s390/mm/vmem.c