Skip to content

Commit

Permalink
s390/kasan: make shadow memory noexec
Browse files Browse the repository at this point in the history
ARCH_HAS_DEBUG_WX feature support brought attention to the fact that
currently initial kasan shadow memory mapped without noexec flag. So fix that.

Temporary initial identity mapping is still created without noexec, but
it is replaced by properly set up paging later.

Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
  • Loading branch information
Vasily Gorbik committed Sep 14, 2020
1 parent 08c8e68 commit d411e3c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions arch/s390/mm/kasan_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,12 @@ static void __init kasan_early_vmemmap_populate(unsigned long address,
pgt_prot_zero = pgprot_val(PAGE_KERNEL_RO);
if (!has_nx)
pgt_prot_zero &= ~_PAGE_NOEXEC;
pgt_prot = pgprot_val(PAGE_KERNEL_EXEC);
sgt_prot = pgprot_val(SEGMENT_KERNEL_EXEC);
pgt_prot = pgprot_val(PAGE_KERNEL);
sgt_prot = pgprot_val(SEGMENT_KERNEL);
if (!has_nx || mode == POPULATE_ONE2ONE) {
pgt_prot &= ~_PAGE_NOEXEC;
sgt_prot &= ~_SEGMENT_ENTRY_NOEXEC;
}

while (address < end) {
pg_dir = pgd_offset_k(address);
Expand Down

0 comments on commit d411e3c

Please sign in to comment.