]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
LoongArch: Automatically disable kaslr if boot from kexec_file
authorYouling Tang <tangyouling@kylinos.cn>
Thu, 2 Oct 2025 14:39:08 +0000 (22:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2025 10:04:18 +0000 (12:04 +0200)
commite53ef27ffa9ea5e70987e4aa87c10408331ed4d2
treef70b2d2087d498fe07e3e9983396b4c7ce76e7ef
parent331c2dd8ca8bad1a3ac10cce847ffb76158eece4
LoongArch: Automatically disable kaslr if boot from kexec_file

commit c8168b4faf1d62cbb320a3e518ad31cdd567cb05 upstream.

Automatically disable kaslr when the kernel loads from kexec_file.

kexec_file loads the secondary kernel image to a non-linked address,
inherently providing KASLR-like randomization.

However, on LoongArch where System RAM may be non-contiguous, enabling
KASLR for the second kernel may relocate it to an invalid memory region
and cause a boot failure. Thus, we disable KASLR when "kexec_file" is
detected in the command line.

To ensure compatibility with older kernels loaded via kexec_file, this
patch should be backported to stable branches.

Cc: stable@vger.kernel.org
Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/loongarch/kernel/relocate.c