提交 eb4bc076 编写于 作者: M Maciej W. Rozycki 提交者: Ralf Baechle

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: NMaciej W. Rozycki <macro@imgtec.com>
Acked-by: NAndrew Morton <akpm@linux-foundation.org>
Acked-by: NAl 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: NRalf Baechle <ralf@linux-mips.org>
上级 90d53a91
...@@ -448,7 +448,7 @@ struct arch_elf_state { ...@@ -448,7 +448,7 @@ struct arch_elf_state {
extern int arch_elf_pt_proc(void *ehdr, void *phdr, struct file *elf, extern int arch_elf_pt_proc(void *ehdr, void *phdr, struct file *elf,
bool is_interp, struct arch_elf_state *state); 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); struct arch_elf_state *state);
extern void mips_set_personality_fp(struct arch_elf_state *state); extern void mips_set_personality_fp(struct arch_elf_state *state);
......
...@@ -128,7 +128,7 @@ int arch_elf_pt_proc(void *_ehdr, void *_phdr, struct file *elf, ...@@ -128,7 +128,7 @@ int arch_elf_pt_proc(void *_ehdr, void *_phdr, struct file *elf,
return 0; 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) struct arch_elf_state *state)
{ {
union { union {
......
...@@ -491,6 +491,7 @@ static inline int arch_elf_pt_proc(struct elfhdr *ehdr, ...@@ -491,6 +491,7 @@ static inline int arch_elf_pt_proc(struct elfhdr *ehdr,
* arch_check_elf() - check an ELF executable * arch_check_elf() - check an ELF executable
* @ehdr: The main ELF header * @ehdr: The main ELF header
* @has_interp: True if the ELF has an interpreter, else false. * @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 * @state: Architecture-specific state preserved throughout the process
* of loading the ELF. * of loading the ELF.
* *
...@@ -502,6 +503,7 @@ static inline int arch_elf_pt_proc(struct elfhdr *ehdr, ...@@ -502,6 +503,7 @@ static inline int arch_elf_pt_proc(struct elfhdr *ehdr,
* with that return code. * with that return code.
*/ */
static inline int arch_check_elf(struct elfhdr *ehdr, bool has_interp, static inline int arch_check_elf(struct elfhdr *ehdr, bool has_interp,
struct elfhdr *interp_ehdr,
struct arch_elf_state *state) struct arch_elf_state *state)
{ {
/* Dummy implementation, always proceed */ /* Dummy implementation, always proceed */
...@@ -829,7 +831,9 @@ static int load_elf_binary(struct linux_binprm *bprm) ...@@ -829,7 +831,9 @@ static int load_elf_binary(struct linux_binprm *bprm)
* still possible to return an error to the code that invoked * still possible to return an error to the code that invoked
* the exec syscall. * 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) if (retval)
goto out_free_dentry; goto out_free_dentry;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册