]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.8.5/arm64-kaslr-fix-breakage-with-config_modversions-y.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.8.5 / arm64-kaslr-fix-breakage-with-config_modversions-y.patch
1 From 9c0e83c371cf4696926c95f9c8c77cd6ea803426 Mon Sep 17 00:00:00 2001
2 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 Date: Thu, 13 Oct 2016 17:42:09 +0100
4 Subject: arm64: kaslr: fix breakage with CONFIG_MODVERSIONS=y
5
6 From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
7
8 commit 9c0e83c371cf4696926c95f9c8c77cd6ea803426 upstream.
9
10 As it turns out, the KASLR code breaks CONFIG_MODVERSIONS, since the
11 kcrctab has an absolute address field that is relocated at runtime
12 when the kernel offset is randomized.
13
14 This has been fixed already for PowerPC in the past, so simply wire up
15 the existing code dealing with this issue.
16
17 Fixes: f80fb3a3d508 ("arm64: add support for kernel ASLR")
18 Tested-by: Timur Tabi <timur@codeaurora.org>
19 Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
20 Signed-off-by: Will Deacon <will.deacon@arm.com>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23 ---
24 arch/arm64/include/asm/module.h | 5 +++++
25 1 file changed, 5 insertions(+)
26
27 --- a/arch/arm64/include/asm/module.h
28 +++ b/arch/arm64/include/asm/module.h
29 @@ -17,6 +17,7 @@
30 #define __ASM_MODULE_H
31
32 #include <asm-generic/module.h>
33 +#include <asm/memory.h>
34
35 #define MODULE_ARCH_VERMAGIC "aarch64"
36
37 @@ -32,6 +33,10 @@ u64 module_emit_plt_entry(struct module
38 Elf64_Sym *sym);
39
40 #ifdef CONFIG_RANDOMIZE_BASE
41 +#ifdef CONFIG_MODVERSIONS
42 +#define ARCH_RELOCATES_KCRCTAB
43 +#define reloc_start (kimage_vaddr - KIMAGE_VADDR)
44 +#endif
45 extern u64 module_alloc_base;
46 #else
47 #define module_alloc_base ((u64)_etext - MODULES_VSIZE)