From: Ard Biesheuvel Date: Thu, 13 Oct 2016 16:42:09 +0000 (+0100) Subject: UPSTREAM: arm64: kaslr: fix breakage with CONFIG_MODVERSIONS=y X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4a8b645cef3caa87b85269078d9e1f02115107b6;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git UPSTREAM: arm64: kaslr: fix breakage with CONFIG_MODVERSIONS=y As it turns out, the KASLR code breaks CONFIG_MODVERSIONS, since the kcrctab has an absolute address field that is relocated at runtime when the kernel offset is randomized. This has been fixed already for PowerPC in the past, so simply wire up the existing code dealing with this issue. Cc: Fixes: f80fb3a3d508 ("arm64: add support for kernel ASLR") Tested-by: Timur Tabi Signed-off-by: Ard Biesheuvel Signed-off-by: Will Deacon Bug: 30369029 (cherry picked from commit 8fe88a4145cdeee486af60e61f5d5a14f804fa45) Signed-off-by: Jeff Vander Stoep Change-Id: Ia40bb68eb5ba7df14214243657948d469f1d5717 --- diff --git a/arch/arm64/include/asm/module.h b/arch/arm64/include/asm/module.h index e12af6754634..06ff7fd9e81f 100644 --- a/arch/arm64/include/asm/module.h +++ b/arch/arm64/include/asm/module.h @@ -17,6 +17,7 @@ #define __ASM_MODULE_H #include +#include #define MODULE_ARCH_VERMAGIC "aarch64" @@ -32,6 +33,10 @@ u64 module_emit_plt_entry(struct module *mod, const Elf64_Rela *rela, Elf64_Sym *sym); #ifdef CONFIG_RANDOMIZE_BASE +#ifdef CONFIG_MODVERSIONS +#define ARCH_RELOCATES_KCRCTAB +#define reloc_start (kimage_vaddr - KIMAGE_VADDR) +#endif extern u64 module_alloc_base; #else #define module_alloc_base ((u64)_etext - MODULES_VSIZE)