Skip to content

Commit

Permalink
crash_dump: Add vmcore_elf32_check_arch
Browse files Browse the repository at this point in the history
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: Daniel Wagner <[email protected]>
Suggested-by: Maciej W. Rozycki <[email protected]>
Reviewed-by: Maciej W. Rozycki <[email protected]>
Cc: [email protected]
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/12535/
Signed-off-by: Ralf Baechle <[email protected]>
  • Loading branch information
Daniel Wagner authored and ralfbaechle committed May 13, 2016
1 parent 331ae5f commit e55d531
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fs/proc/vmcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ static int __init parse_crash_elf32_headers(void)
/* Do some basic Verification. */
if (memcmp(ehdr.e_ident, ELFMAG, SELFMAG) != 0 ||
(ehdr.e_type != ET_CORE) ||
!elf_check_arch(&ehdr) ||
!vmcore_elf32_check_arch(&ehdr) ||
ehdr.e_ident[EI_CLASS] != ELFCLASS32||
ehdr.e_ident[EI_VERSION] != EV_CURRENT ||
ehdr.e_version != EV_CURRENT ||
Expand Down
8 changes: 6 additions & 2 deletions include/linux/crash_dump.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ void vmcore_cleanup(void);

/*
* Architecture code can redefine this if there are any special checks
* needed for 64-bit ELF vmcores. In case of 32-bit only architecture,
* this can be set to zero.
* needed for 32-bit ELF or 64-bit ELF vmcores. In case of 32-bit
* 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
#define vmcore_elf64_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x))
#endif
Expand Down

0 comments on commit e55d531

Please sign in to comment.