diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2016-02-15 14:46:49 +0100 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-03-22 11:10:34 -0400 |
commit | 09b4fd2014b1ef7d46df8df553f94254ba2a0497 (patch) | |
tree | f1d449429b86e1b52bd927bd4f6fe11ae6f74659 /init | |
parent | 1b3ce90bcd25ea9ba08450e605df29e16387a7ca (diff) | |
download | lwn-09b4fd2014b1ef7d46df8df553f94254ba2a0497.tar.gz lwn-09b4fd2014b1ef7d46df8df553f94254ba2a0497.zip |
s390/mm: four page table levels vs. fork
[ Upstream commit 3446c13b268af86391d06611327006b059b8bab1 ]
The fork of a process with four page table levels is broken since
git commit 6252d702c5311ce9 "[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>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Diffstat (limited to 'init')
0 files changed, 0 insertions, 0 deletions