Skip to content

Commit 1d7864a

Browse files
hcahcagregkh
authored andcommitted
s390/mm: Do not map lowcore with identity mapping
[ Upstream commit 93f616f ] Since the identity mapping is pinned to address zero the lowcore is always also mapped to address zero, this happens regardless of the relocate_lowcore command line option. If the option is specified the lowcore is mapped twice, instead of only once. This means that NULL pointer accesses will succeed instead of causing an exception (low address protection still applies, but covers only parts). To fix this never map the first two pages of physical memory with the identity mapping. Fixes: 32db401 ("s390/mm: Pin identity mapping base to zero") Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 53492b4 commit 1d7864a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/s390/boot/vmem.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@ void setup_vmem(unsigned long kernel_start, unsigned long kernel_end, unsigned l
530530
lowcore_address + sizeof(struct lowcore),
531531
POPULATE_LOWCORE);
532532
for_each_physmem_usable_range(i, &start, &end) {
533+
/* Do not map lowcore with identity mapping */
534+
if (!start)
535+
start = sizeof(struct lowcore);
533536
pgtable_populate((unsigned long)__identity_va(start),
534537
(unsigned long)__identity_va(end),
535538
POPULATE_IDENTITY);

0 commit comments

Comments
 (0)