binfmt_elf: cleanups
This cleans up a few bits in binfmt_elf.c and binfmts.h: - the hasvdso field in struct linux_binfmt is unused, so remove it and the only initialization of it - the elf_map CPP symbol is not defined anywhere in the kernel, so remove an unnecessary #ifndef elf_map - reduce excessive indentation in elf_format's initializer - add missing spaces, remove extraneous spaces No functional changes, but tested on x86 (32 and 64 bit), powerpc (32 and 64 bit), sparc64, arm, and alpha. Signed-off-by: Mikael Pettersson <mikpe@it.uu.se> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Родитель
52bd19f769
Коммит
f670d0ecda
|
@ -66,12 +66,11 @@ static int elf_core_dump(struct coredump_params *cprm);
|
||||||
#define ELF_PAGEALIGN(_v) (((_v) + ELF_MIN_ALIGN - 1) & ~(ELF_MIN_ALIGN - 1))
|
#define ELF_PAGEALIGN(_v) (((_v) + ELF_MIN_ALIGN - 1) & ~(ELF_MIN_ALIGN - 1))
|
||||||
|
|
||||||
static struct linux_binfmt elf_format = {
|
static struct linux_binfmt elf_format = {
|
||||||
.module = THIS_MODULE,
|
.module = THIS_MODULE,
|
||||||
.load_binary = load_elf_binary,
|
.load_binary = load_elf_binary,
|
||||||
.load_shlib = load_elf_library,
|
.load_shlib = load_elf_library,
|
||||||
.core_dump = elf_core_dump,
|
.core_dump = elf_core_dump,
|
||||||
.min_coredump = ELF_EXEC_PAGESIZE,
|
.min_coredump = ELF_EXEC_PAGESIZE,
|
||||||
.hasvdso = 1
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
|
#define BAD_ADDR(x) ((unsigned long)(x) >= TASK_SIZE)
|
||||||
|
@ -316,8 +315,6 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr *exec,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef elf_map
|
|
||||||
|
|
||||||
static unsigned long elf_map(struct file *filep, unsigned long addr,
|
static unsigned long elf_map(struct file *filep, unsigned long addr,
|
||||||
struct elf_phdr *eppnt, int prot, int type,
|
struct elf_phdr *eppnt, int prot, int type,
|
||||||
unsigned long total_size)
|
unsigned long total_size)
|
||||||
|
@ -354,8 +351,6 @@ static unsigned long elf_map(struct file *filep, unsigned long addr,
|
||||||
return(map_addr);
|
return(map_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* !elf_map */
|
|
||||||
|
|
||||||
static unsigned long total_mapping_size(struct elf_phdr *cmds, int nr)
|
static unsigned long total_mapping_size(struct elf_phdr *cmds, int nr)
|
||||||
{
|
{
|
||||||
int i, first_idx = -1, last_idx = -1;
|
int i, first_idx = -1, last_idx = -1;
|
||||||
|
@ -421,7 +416,7 @@ static unsigned long load_elf_interp(struct elfhdr *interp_elf_ex,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
retval = kernel_read(interpreter, interp_elf_ex->e_phoff,
|
retval = kernel_read(interpreter, interp_elf_ex->e_phoff,
|
||||||
(char *)elf_phdata,size);
|
(char *)elf_phdata, size);
|
||||||
error = -EIO;
|
error = -EIO;
|
||||||
if (retval != size) {
|
if (retval != size) {
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
|
@ -601,7 +596,7 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
|
||||||
goto out;
|
goto out;
|
||||||
if (!elf_check_arch(&loc->elf_ex))
|
if (!elf_check_arch(&loc->elf_ex))
|
||||||
goto out;
|
goto out;
|
||||||
if (!bprm->file->f_op||!bprm->file->f_op->mmap)
|
if (!bprm->file->f_op || !bprm->file->f_op->mmap)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* Now read in all of the header information */
|
/* Now read in all of the header information */
|
||||||
|
@ -761,8 +756,8 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
|
||||||
/* There was a PT_LOAD segment with p_memsz > p_filesz
|
/* There was a PT_LOAD segment with p_memsz > p_filesz
|
||||||
before this one. Map anonymous pages, if needed,
|
before this one. Map anonymous pages, if needed,
|
||||||
and clear the area. */
|
and clear the area. */
|
||||||
retval = set_brk (elf_bss + load_bias,
|
retval = set_brk(elf_bss + load_bias,
|
||||||
elf_brk + load_bias);
|
elf_brk + load_bias);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
send_sig(SIGKILL, current, 0);
|
send_sig(SIGKILL, current, 0);
|
||||||
goto out_free_dentry;
|
goto out_free_dentry;
|
||||||
|
|
|
@ -25,7 +25,7 @@ struct pt_regs;
|
||||||
/*
|
/*
|
||||||
* This structure is used to hold the arguments that are used when loading binaries.
|
* This structure is used to hold the arguments that are used when loading binaries.
|
||||||
*/
|
*/
|
||||||
struct linux_binprm{
|
struct linux_binprm {
|
||||||
char buf[BINPRM_BUF_SIZE];
|
char buf[BINPRM_BUF_SIZE];
|
||||||
#ifdef CONFIG_MMU
|
#ifdef CONFIG_MMU
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
|
@ -93,7 +93,6 @@ struct linux_binfmt {
|
||||||
int (*load_shlib)(struct file *);
|
int (*load_shlib)(struct file *);
|
||||||
int (*core_dump)(struct coredump_params *cprm);
|
int (*core_dump)(struct coredump_params *cprm);
|
||||||
unsigned long min_coredump; /* minimal dump size */
|
unsigned long min_coredump; /* minimal dump size */
|
||||||
int hasvdso;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern int __register_binfmt(struct linux_binfmt *fmt, int insert);
|
extern int __register_binfmt(struct linux_binfmt *fmt, int insert);
|
||||||
|
@ -113,7 +112,7 @@ extern void unregister_binfmt(struct linux_binfmt *);
|
||||||
|
|
||||||
extern int prepare_binprm(struct linux_binprm *);
|
extern int prepare_binprm(struct linux_binprm *);
|
||||||
extern int __must_check remove_arg_zero(struct linux_binprm *);
|
extern int __must_check remove_arg_zero(struct linux_binprm *);
|
||||||
extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
|
extern int search_binary_handler(struct linux_binprm *, struct pt_regs *);
|
||||||
extern int flush_old_exec(struct linux_binprm * bprm);
|
extern int flush_old_exec(struct linux_binprm * bprm);
|
||||||
extern void setup_new_exec(struct linux_binprm * bprm);
|
extern void setup_new_exec(struct linux_binprm * bprm);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче