Commit 92ae0c1e authored by Vasily Gorbik's avatar Vasily Gorbik
Browse files

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: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 20216c12
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -440,6 +440,7 @@ static unsigned long setup_kernel_memory_layout(unsigned long kernel_size)
	max_mappable = max(ident_map_size, MAX_DCSS_ADDR);
	max_mappable = min(max_mappable, vmemmap_start);
#ifdef CONFIG_RANDOMIZE_IDENTITY_BASE
	if (kaslr_enabled())
		__identity_base = round_down(vmemmap_start - max_mappable, rte_size);
#endif
	boot_debug("identity map:        0x%016lx-0x%016lx\n", __identity_base,