summaryrefslogtreecommitdiff
path: root/arch/loongarch/include/asm/setup.h
diff options
context:
space:
mode:
authorYouling Tang <tangyouling@loongson.cn>2023-02-25 10:52:56 +0300
committerHuacai Chen <chenhuacai@loongson.cn>2023-02-25 17:12:17 +0300
commite5f02b51fa0cb785e352e77271a65e96051b789b (patch)
tree843d66d45eec2f69de38952774c747ed29adf065 /arch/loongarch/include/asm/setup.h
parentd8da19fbdedd5852592fbba18a7348e3f09500e6 (diff)
downloadlinux-e5f02b51fa0cb785e352e77271a65e96051b789b.tar.xz
LoongArch: Add support for kernel address space layout randomization (KASLR)
This patch adds support for relocating the kernel to a random address. Entropy is derived from the banner, which will change every build and random_get_entropy() which should provide additional runtime entropy. The kernel is relocated by up to RANDOMIZE_BASE_MAX_OFFSET bytes from its link address. Because relocation happens so early during the kernel booting, the amount of physical memory has not yet been determined. This means the only way to limit relocation within the available memory is via Kconfig. So we limit the maximum value of RANDOMIZE_BASE_MAX_OFFSET to 256M (0x10000000) because our memory layout has many holes. Signed-off-by: Youling Tang <tangyouling@loongson.cn> Signed-off-by: Xi Ruoyao <xry111@xry111.site> # Fix compiler warnings Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/include/asm/setup.h')
-rw-r--r--arch/loongarch/include/asm/setup.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/loongarch/include/asm/setup.h b/arch/loongarch/include/asm/setup.h
index 27d968655b4b..be05c0e706a2 100644
--- a/arch/loongarch/include/asm/setup.h
+++ b/arch/loongarch/include/asm/setup.h
@@ -33,7 +33,7 @@ extern long __la_abs_end;
extern long __rela_dyn_begin;
extern long __rela_dyn_end;
-extern void __init relocate_kernel(void);
+extern void * __init relocate_kernel(void);
#endif