]> git.baikalelectronics.ru Git - kernel.git/commit
s390/boot: fix mem_detect extended area allocation
authorVasily Gorbik <gor@linux.ibm.com>
Mon, 23 Jan 2023 11:49:47 +0000 (12:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:00 +0000 (09:33 +0100)
commitde650001c263e34efbddb2da3318140d6cc0a54a
tree3be04127749500af0671dd1a74f22e516afe0eb0
parenta8708b3bfb54f1f1b4fe16f0a73cb59feffc848f
s390/boot: fix mem_detect extended area allocation

[ Upstream commit 2db7e7c4b86ff76fbeb4bb86265349c1dee4288f ]

Allocation of mem_detect extended area was not considered neither
in commit 55590fd945be ("s390/ipl: read IPL report at early boot")
nor in commit 2296e9899f6f ("s390/kernel: add support for kernel address
space layout randomization (KASLR)"). As a result mem_detect extended
theoretically may overlap with ipl report or randomized kernel image
position. But as mem_detect code will allocate extended area only
upon exceeding 255 online regions (which should alternate with offline
memory regions) it is not seen in practice.

To make sure mem_detect extended area does not overlap with ipl report
or randomized kernel position extend usage of "safe_addr". Make initrd
handling and mem_detect extended area allocation code move it further
right and make KASLR takes in into consideration as well.

Fixes: 55590fd945be ("s390/ipl: read IPL report at early boot")
Fixes: 2296e9899f6f ("s390/kernel: add support for kernel address space layout randomization (KASLR)")
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/boot/boot.h
arch/s390/boot/kaslr.c
arch/s390/boot/mem_detect.c
arch/s390/boot/startup.c