Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932447AbbKMArx (ORCPT ); Thu, 12 Nov 2015 19:47:53 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:52602 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932108AbbKMArv (ORCPT ); Thu, 12 Nov 2015 19:47:51 -0500 Date: Fri, 13 Nov 2015 00:47:48 +0000 From: "Maciej W. Rozycki" To: Ralf Baechle CC: Andrew Morton , Matthew Fortune , , Subject: [PATCH 5/8] ELF: Also pass any interpreter's file header to `arch_check_elf' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [10.100.200.62] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2963 Lines: 68 Also pass any interpreter's file header to `arch_check_elf' so that any architecture handler can have a look at it if needed. Signed-off-by: Maciej W. Rozycki --- linux-arch-check-elf-interp.diff Index: linux-sfr-test/arch/mips/include/asm/elf.h =================================================================== --- linux-sfr-test.orig/arch/mips/include/asm/elf.h 2015-11-10 18:06:16.547399000 +0000 +++ linux-sfr-test/arch/mips/include/asm/elf.h 2015-11-11 02:20:02.099077000 +0000 @@ -448,7 +448,7 @@ struct arch_elf_state { extern int arch_elf_pt_proc(void *ehdr, void *phdr, struct file *elf, bool is_interp, struct arch_elf_state *state); -extern int arch_check_elf(void *ehdr, bool has_interpreter, +extern int arch_check_elf(void *ehdr, bool has_interpreter, void *interp_ehdr, struct arch_elf_state *state); extern void mips_set_personality_fp(struct arch_elf_state *state); Index: linux-sfr-test/arch/mips/kernel/elf.c =================================================================== --- linux-sfr-test.orig/arch/mips/kernel/elf.c 2015-11-11 02:19:56.376032000 +0000 +++ linux-sfr-test/arch/mips/kernel/elf.c 2015-11-11 02:20:02.104077000 +0000 @@ -128,7 +128,7 @@ int arch_elf_pt_proc(void *_ehdr, void * return 0; } -int arch_check_elf(void *_ehdr, bool has_interpreter, +int arch_check_elf(void *_ehdr, bool has_interpreter, void *_interp_ehdr, struct arch_elf_state *state) { union { Index: linux-sfr-test/fs/binfmt_elf.c =================================================================== --- linux-sfr-test.orig/fs/binfmt_elf.c 2015-11-10 18:08:00.126238000 +0000 +++ linux-sfr-test/fs/binfmt_elf.c 2015-11-11 02:20:02.126077000 +0000 @@ -490,6 +490,7 @@ static inline int arch_elf_pt_proc(struc * arch_check_elf() - check an ELF executable * @ehdr: The main ELF header * @has_interp: True if the ELF has an interpreter, else false. + * @interp_ehdr: The interpreter's ELF header * @state: Architecture-specific state preserved throughout the process * of loading the ELF. * @@ -501,6 +502,7 @@ static inline int arch_elf_pt_proc(struc * with that return code. */ static inline int arch_check_elf(struct elfhdr *ehdr, bool has_interp, + struct elfhdr *interp_ehdr, struct arch_elf_state *state) { /* Dummy implementation, always proceed */ @@ -828,7 +830,9 @@ static int load_elf_binary(struct linux_ * still possible to return an error to the code that invoked * the exec syscall. */ - retval = arch_check_elf(&loc->elf_ex, !!interpreter, &arch_state); + retval = arch_check_elf(&loc->elf_ex, + !!interpreter, &loc->interp_elf_ex, + &arch_state); if (retval) goto out_free_dentry; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/