From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932315AbcBHPo6 (ORCPT ); Mon, 8 Feb 2016 10:44:58 -0500 Received: from mail.bmw-carit.de ([62.245.222.98]:46706 "EHLO linuxmail.bmw-carit.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932220AbcBHPow (ORCPT ); Mon, 8 Feb 2016 10:44:52 -0500 From: Daniel Wagner To: "Maciej W. Rozycki" Cc: Ralf Baechle , linux-kernel@vger.kernel.org, linux-mips@linux-mips.org, Daniel Wagner Subject: [PATCH v3 2/3] crash_dump: Add vmcore_elf32_check_arch Date: Mon, 8 Feb 2016 16:44:37 +0100 Message-Id: <1454946278-13859-3-git-send-email-daniel.wagner@bmw-carit.de> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454946278-13859-1-git-send-email-daniel.wagner@bmw-carit.de> References: <1454946278-13859-1-git-send-email-daniel.wagner@bmw-carit.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Suggested-by: Maciej W. Rozycki --- fs/proc/vmcore.c | 2 +- include/linux/crash_dump.h | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 4e61388..c8ed209 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c @@ -1068,7 +1068,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 || diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h index 3849fce..3873697 100644 --- a/include/linux/crash_dump.h +++ b/include/linux/crash_dump.h @@ -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 -- 2.5.0