X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Fbinfmt_elf.c;h=c2eac2a50bd266889786d9eb825fdb96fa1e2d19;hb=b5a7c4f5835ae2805d00ca39709002cb03364143;hp=80ca932ba0bddaaf2d5a520d5fe408c14af508db;hpb=6150c32589d1976ca8a5c987df951088c05a7542;p=linux-2.6-omap-h63xx.git diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 80ca932ba0b..c2eac2a50bd 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -622,7 +622,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) goto out_free_file; retval = -ENOMEM; - elf_interpreter = (char *) kmalloc(elf_ppnt->p_filesz, + elf_interpreter = kmalloc(elf_ppnt->p_filesz, GFP_KERNEL); if (!elf_interpreter) goto out_free_file; @@ -938,6 +938,11 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs) kfree(elf_interpreter); } else { elf_entry = loc->elf_ex.e_entry; + if (BAD_ADDR(elf_entry)) { + send_sig(SIGSEGV, current, 0); + retval = -ENOEXEC; /* Nobody gets to see this, but.. */ + goto out_free_dentry; + } } kfree(elf_phdata); @@ -1218,7 +1223,7 @@ static int writenote(struct memelfnote *men, struct file *file) if (!dump_seek(file, (off))) \ goto end_coredump; -static inline void fill_elf_header(struct elfhdr *elf, int segs) +static void fill_elf_header(struct elfhdr *elf, int segs) { memcpy(elf->e_ident, ELFMAG, SELFMAG); elf->e_ident[EI_CLASS] = ELF_CLASS; @@ -1243,7 +1248,7 @@ static inline void fill_elf_header(struct elfhdr *elf, int segs) return; } -static inline void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, off_t offset) +static void fill_elf_note_phdr(struct elf_phdr *phdr, int sz, off_t offset) { phdr->p_type = PT_NOTE; phdr->p_offset = offset; @@ -1634,17 +1639,17 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) ELF_CORE_WRITE_EXTRA_DATA; #endif - if ((off_t) file->f_pos != offset) { + if ((off_t)file->f_pos != offset) { /* Sanity check */ - printk("elf_core_dump: file->f_pos (%ld) != offset (%ld)\n", - (off_t) file->f_pos, offset); + printk(KERN_WARNING "elf_core_dump: file->f_pos (%ld) != offset (%ld)\n", + (off_t)file->f_pos, offset); } end_coredump: set_fs(fs); cleanup: - while(!list_empty(&thread_list)) { + while (!list_empty(&thread_list)) { struct list_head *tmp = thread_list.next; list_del(tmp); kfree(list_entry(tmp, struct elf_thread_status, list));