linux/arch/s390
Martin Schwidefsky 3446c13b26 s390/mm: four page table levels vs. fork
The fork of a process with four page table levels is broken since
git commit 6252d702c5 "[S390] dynamic page tables."

All new mm contexts are created with three page table levels and
an asce limit of 4TB. If the parent has four levels dup_mmap will
add vmas to the new context which are outside of the asce limit.
The subsequent call to copy_page_range will walk the three level
page table structure of the new process with non-zero pgd and pud
indexes. This leads to memory clobbers as the pgd_index *and* the
pud_index is added to the mm->pgd pointer without a pgd_deref
in between.

The init_new_context() function is selecting the number of page
table levels for a new context. The function is used by mm_init()
which in turn is called by dup_mm() and mm_alloc(). These two are
used by fork() and exec(). The init_new_context() function can
distinguish the two cases by looking at mm->context.asce_limit,
for fork() the mm struct has been copied and the number of page
table levels may not change. For exec() the mm_alloc() function
set the new mm structure to zero, in this case a three-level page
table is created as the temporary stack space is located at
STACK_TOP_MAX = 4TB.

This fixes CVE-2016-2143.

Reported-by: Marcin Kościelnicki <koriakin@0x04.net>
Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: stable@vger.kernel.org
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
2016-03-10 09:21:24 +01:00
..
appldata s390: appldata: drop owner assignment from platform_drivers 2014-10-20 16:20:13 +02:00
boot s390/boot/decompression: disable floating point in decompressor 2015-09-29 14:45:10 +02:00
configs s390/configs: update default configurations 2016-01-11 13:01:28 +01:00
crypto crypto: s390/sha - replace raw value by their coresponding define 2015-10-15 21:05:11 +08:00
hypfs wrappers for ->i_mutex access 2016-01-22 18:04:28 -05:00
include s390/mm: four page table levels vs. fork 2016-03-10 09:21:24 +01:00
kernel s390/cpumf: Fix lpp detection 2016-03-08 10:38:06 +01:00
kvm Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2016-01-29 16:05:18 -08:00
lib s390/spinlock: do not yield to a CPU in udelay/mdelay 2015-11-27 09:24:18 +01:00
mm s390/maccess: reduce stnsm instructions 2016-02-17 09:05:04 +01:00
net bpf: move clearing of A/X into classic to eBPF migration prologue 2015-12-18 16:04:51 -05:00
numa s390/numa: move numa_init_late() from device to arch_initcall 2016-01-26 12:45:24 +01:00
oprofile s390/oprofile: fix address range for asynchronous stack 2016-02-10 09:25:22 +01:00
pci s390/pci: remove iomap sanity checks 2016-01-26 12:46:45 +01:00
tools s390/facilities: add helper tool to generate facility lists 2015-12-18 14:59:20 +01:00
defconfig s390/configs: update default configurations 2016-01-11 13:01:28 +01:00
Kbuild s390/numa: add core infrastructure 2015-08-03 18:40:25 +02:00
Kconfig dma-mapping: always provide the dma_map_ops based implementation 2016-01-20 17:09:18 -08:00
Kconfig.debug arch: consolidate CONFIG_STRICT_DEVM in lib/Kconfig.debug 2016-01-09 06:30:49 -08:00
Makefile s390/facilities: add helper tool to generate facility lists 2015-12-18 14:59:20 +01:00