Skip to content

Commit eb4bc07

Browse files
Maciej W. Rozyckiralfbaechle
authored andcommitted
ELF: Also pass any interpreter's file header to `arch_check_elf'
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 <macro@imgtec.com> Acked-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Al Viro <viro@zeniv.linux.org.uk> Cc: Matthew Fortune <Matthew.Fortune@imgtec.com> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/11478/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent 90d53a9 commit eb4bc07

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎arch/mips/include/asm/elf.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ struct arch_elf_state {
448448
extern int arch_elf_pt_proc(void *ehdr, void *phdr, struct file *elf,
449449
bool is_interp, struct arch_elf_state *state);
450450

451-
extern int arch_check_elf(void *ehdr, bool has_interpreter,
451+
extern int arch_check_elf(void *ehdr, bool has_interpreter, void *interp_ehdr,
452452
struct arch_elf_state *state);
453453

454454
extern void mips_set_personality_fp(struct arch_elf_state *state);

‎arch/mips/kernel/elf.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ int arch_elf_pt_proc(void *_ehdr, void *_phdr, struct file *elf,
128128
return 0;
129129
}
130130

131-
int arch_check_elf(void *_ehdr, bool has_interpreter,
131+
int arch_check_elf(void *_ehdr, bool has_interpreter, void *_interp_ehdr,
132132
struct arch_elf_state *state)
133133
{
134134
union {

‎fs/binfmt_elf.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ static inline int arch_elf_pt_proc(struct elfhdr *ehdr,
491491
* arch_check_elf() - check an ELF executable
492492
* @ehdr: The main ELF header
493493
* @has_interp: True if the ELF has an interpreter, else false.
494+
* @interp_ehdr: The interpreter's ELF header
494495
* @state: Architecture-specific state preserved throughout the process
495496
* of loading the ELF.
496497
*
@@ -502,6 +503,7 @@ static inline int arch_elf_pt_proc(struct elfhdr *ehdr,
502503
* with that return code.
503504
*/
504505
static inline int arch_check_elf(struct elfhdr *ehdr, bool has_interp,
506+
struct elfhdr *interp_ehdr,
505507
struct arch_elf_state *state)
506508
{
507509
/* Dummy implementation, always proceed */
@@ -829,7 +831,9 @@ static int load_elf_binary(struct linux_binprm *bprm)
829831
* still possible to return an error to the code that invoked
830832
* the exec syscall.
831833
*/
832-
retval = arch_check_elf(&loc->elf_ex, !!interpreter, &arch_state);
834+
retval = arch_check_elf(&loc->elf_ex,
835+
!!interpreter, &loc->interp_elf_ex,
836+
&arch_state);
833837
if (retval)
834838
goto out_free_dentry;
835839

0 commit comments

Comments
 (0)