Commit e55d5312 authored by Daniel Wagner's avatar Daniel Wagner Committed by Ralf Baechle

crash_dump: Add vmcore_elf32_check_arch

parse_crash_elf{32|64}_headers will check the headers via the
elf_check_arch respectively vmcore_elf64_check_arch macro.

The MIPS architecture implements those two macros differently.
In order to make the differentiation more explicit, let's introduce
an vmcore_elf32_check_arch to allow the archs to overwrite it.
Signed-off-by: default avatarDaniel Wagner <daniel.wagner@bmw-carit.de>
Suggested-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
Reviewed-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/12535/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 331ae5fc
...@@ -1071,7 +1071,7 @@ static int __init parse_crash_elf32_headers(void) ...@@ -1071,7 +1071,7 @@ static int __init parse_crash_elf32_headers(void)
/* Do some basic Verification. */ /* Do some basic Verification. */
if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0 || if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0 ||
(ehdr.e_type != ET_CORE) || (ehdr.e_type != ET_CORE) ||
!elf_check_arch(&ehdr) || !vmcore_elf32_check_arch(&ehdr) ||
ehdr.e_ident[EI_CLASS] != ELFCLASS32|| ehdr.e_ident[EI_CLASS] != ELFCLASS32||
ehdr.e_ident[EI_VERSION] != EV_CURRENT || ehdr.e_ident[EI_VERSION] != EV_CURRENT ||
ehdr.e_version != EV_CURRENT || ehdr.e_version != EV_CURRENT ||
......
...@@ -34,9 +34,13 @@ void vmcore_cleanup(void); ...@@ -34,9 +34,13 @@ void vmcore_cleanup(void);
/* /*
* Architecture code can redefine this if there are any special checks * Architecture code can redefine this if there are any special checks
* needed for 64-bit ELF vmcores. In case of 32-bit only architecture, * needed for 32-bit ELF or 64-bit ELF vmcores. In case of 32-bit
* this can be set to zero. * only architecture, vmcore_elf64_check_arch can be set to zero.
*/ */
#ifndef vmcore_elf32_check_arch
#define vmcore_elf32_check_arch(x) elf_check_arch(x)
#endif
#ifndef vmcore_elf64_check_arch #ifndef vmcore_elf64_check_arch
#define vmcore_elf64_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x)) #define vmcore_elf64_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x))
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment