Skip to content

Commit 7841412

Browse files
Ard BiesheuvelAlex Shi
authored andcommitted
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: <stable@vger.kernel.org> Fixes: f80fb3a3d508 ("arm64: add support for kernel ASLR") Tested-by: Timur Tabi <timur@codeaurora.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Will Deacon <will.deacon@arm.com> (cherry picked from commit 9c0e83c371cf4696926c95f9c8c77cd6ea803426) Signed-off-by: Alex Shi <alex.shi@linaro.org>
1 parent cac5bc4 commit 7841412

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

arch/arm64/include/asm/module.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define __ASM_MODULE_H
1818

1919
#include <asm-generic/module.h>
20+
#include <asm/memory.h>
2021

2122
#define MODULE_ARCH_VERMAGIC "aarch64"
2223

@@ -32,6 +33,10 @@ u64 module_emit_plt_entry(struct module *mod, const Elf64_Rela *rela,
3233
Elf64_Sym *sym);
3334

3435
#ifdef CONFIG_RANDOMIZE_BASE
36+
#ifdef CONFIG_MODVERSIONS
37+
#define ARCH_RELOCATES_KCRCTAB
38+
#define reloc_start (kimage_vaddr - KIMAGE_VADDR)
39+
#endif
3540
extern u64 module_alloc_base;
3641
#else
3742
#define module_alloc_base ((u64)_etext - MODULES_VSIZE)

0 commit comments

Comments
 (0)