Skip to content

Commit 92ae0c1

Browse files
author
Vasily Gorbik
committed
s390/boot: Respect kaslr_enabled() for identity randomization
CONFIG_RANDOMIZE_IDENTITY_BASE only enables support for randomizing the identity mapping base. The randomization (identity base != 0) itself should happen only when KASLR is enabled at runtime. Guard the __identity_base update with kaslr_enabled() so nokaslr (and other KASLR-disabled cases) keep the non-randomized identity mapping at 0. Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
1 parent 20216c1 commit 92ae0c1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

arch/s390/boot/startup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ static unsigned long setup_kernel_memory_layout(unsigned long kernel_size)
440440
max_mappable = max(ident_map_size, MAX_DCSS_ADDR);
441441
max_mappable = min(max_mappable, vmemmap_start);
442442
#ifdef CONFIG_RANDOMIZE_IDENTITY_BASE
443-
__identity_base = round_down(vmemmap_start - max_mappable, rte_size);
443+
if (kaslr_enabled())
444+
__identity_base = round_down(vmemmap_start - max_mappable, rte_size);
444445
#endif
445446
boot_debug("identity map: 0x%016lx-0x%016lx\n", __identity_base,
446447
__identity_base + ident_map_size);

0 commit comments

Comments
 (0)