summaryrefslogtreecommitdiff
path: root/kexec
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2018-04-06 11:45:28 +0900
committerSimon Horman <horms@verge.net.au>2018-04-10 11:12:12 +0200
commit5c08af7a068d6d3abadbd8d8c41f78744daf258c (patch)
treef33ab5f09def336d85655968e1af7b4d77dda3ab /kexec
parentb2b05352ae5e9b027fa9b166f47e97ae8fdf7db6 (diff)
arm64: fix an issue with kaslr-enabled vmlinux
Normally vmlinux for arm64 is of ET_EXEC type, while if built with CONFIG_RANDAMIZE_BASE (that is KASLR), it will be of ET_DYN type. Meanwhile, physical address field of segments in vmlinux has actually the same value as virtual address field. Accordingly, in this case, it totally makes no sense to check for validity of segments against physical memory ranges and, if necessary, relocate them in elf_exec_load() on arm64. This patch allows to unconditionally skip the check on arm64. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec')
-rw-r--r--kexec/kexec-elf-exec.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kexec/kexec-elf-exec.c b/kexec/kexec-elf-exec.c
index cb62d04..a9329ac 100644
--- a/kexec/kexec-elf-exec.c
+++ b/kexec/kexec-elf-exec.c
@@ -63,9 +63,13 @@ int elf_exec_load(struct mem_ehdr *ehdr, struct kexec_info *info)
/* If I have a dynamic executable find it's size
* and then find a location for it in memory.
+ * Note on arm64:
+ * arm64's vmlinux has virtual address in physical address
+ * field of PT_LOAD segments. So the following validity check
+ * and relocation makes no sense on arm64.
*/
base = 0;
- if (ehdr->e_type == ET_DYN) {
+ if ((ehdr->e_machine != EM_AARCH64) && (ehdr->e_type == ET_DYN)) {
unsigned long first, last, align;
first = ULONG_MAX;
last = 0;