Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: 6485/5: proc/vmcore - allow archs to override vmcore_elf_check_arch()

Allow architectures to redefine this macro if needed. This is useful for
example in architectures where 64-bit ELF vmcores are not supported.
Specifying zero vmcore_elf64_check_arch() allows compiler to optimize
away unnecessary parts of parse_crash_elf64_headers().

We also rename the macro to vmcore_elf64_check_arch() to reflect that it
is used for 64-bit vmcores only.

Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by

Mika Westerberg and committed by
Russell King
9833c394 e8a7e48b

+9 -2
+1 -1
fs/proc/vmcore.c
··· 499 499 /* Do some basic Verification. */ 500 500 if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0 || 501 501 (ehdr.e_type != ET_CORE) || 502 - !vmcore_elf_check_arch(&ehdr) || 502 + !vmcore_elf64_check_arch(&ehdr) || 503 503 ehdr.e_ident[EI_CLASS] != ELFCLASS64 || 504 504 ehdr.e_ident[EI_VERSION] != EV_CURRENT || 505 505 ehdr.e_version != EV_CURRENT ||
+8 -1
include/linux/crash_dump.h
··· 20 20 #define vmcore_elf_check_arch_cross(x) 0 21 21 #endif 22 22 23 - #define vmcore_elf_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) 23 + /* 24 + * Architecture code can redefine this if there are any special checks 25 + * needed for 64-bit ELF vmcores. In case of 32-bit only architecture, 26 + * this can be set to zero. 27 + */ 28 + #ifndef vmcore_elf64_check_arch 29 + #define vmcore_elf64_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) 30 + #endif 24 31 25 32 /* 26 33 * is_kdump_kernel() checks whether this kernel is booting after a panic of