[PATCH] IPMI oops fix
[safe/jmp/linux-2.6] / fs / binfmt_elf.c
index 76ec9d8..f36f221 100644 (file)
@@ -251,7 +251,7 @@ create_elf_tables(struct linux_binprm *bprm, struct elfhdr * exec,
        }
 
        /* Populate argv and envp */
-       p = current->mm->arg_start;
+       p = current->mm->arg_end = current->mm->arg_start;
        while (argc-- > 0) {
                size_t len;
                __put_user((elf_addr_t)p, argv++);
@@ -773,8 +773,8 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
 
        /* Do this so that we can load the interpreter, if need be.  We will
           change some of these later */
-       set_mm_counter(current->mm, rss, 0);
        current->mm->free_area_cache = current->mm->mmap_base;
+       current->mm->cached_hole_size = 0;
        retval = setup_arg_pages(bprm, randomize_stack_top(STACK_TOP),
                                 executable_stack);
        if (retval < 0) {
@@ -782,14 +782,6 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                goto out_free_dentry;
        }
        
-#ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES
-       retval = arch_setup_additional_pages(bprm, executable_stack);
-       if (retval < 0) {
-               send_sig(SIGKILL, current, 0);
-               goto out_free_dentry;
-       }
-#endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */
-
        current->mm->start_stack = bprm->p;
 
        /* Now we do a little grungy work by mmaping the ELF image into
@@ -912,7 +904,7 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
                send_sig(SIGKILL, current, 0);
                goto out_free_dentry;
        }
-       if (padzero(elf_bss)) {
+       if (likely(elf_bss != elf_brk) && unlikely(padzero(elf_bss))) {
                send_sig(SIGSEGV, current, 0);
                retval = -EFAULT; /* Nobody gets to see this, but.. */
                goto out_free_dentry;
@@ -949,6 +941,14 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)
 
        set_binfmt(&elf_format);
 
+#ifdef ARCH_HAS_SETUP_ADDITIONAL_PAGES
+       retval = arch_setup_additional_pages(bprm, executable_stack);
+       if (retval < 0) {
+               send_sig(SIGKILL, current, 0);
+               goto out;
+       }
+#endif /* ARCH_HAS_SETUP_ADDITIONAL_PAGES */
+
        compute_creds(bprm);
        current->flags &= ~PF_FORKNOEXEC;
        create_elf_tables(bprm, &loc->elf_ex, (interpreter_type == INTERPRETER_AOUT),
@@ -1006,8 +1006,7 @@ out_free_dentry:
        if (interpreter)
                fput(interpreter);
 out_free_interp:
-       if (elf_interpreter)
-               kfree(elf_interpreter);
+       kfree(elf_interpreter);
 out_free_file:
        sys_close(elf_exec_fileno);
 out_free_fh:
@@ -1125,7 +1124,7 @@ static int dump_write(struct file *file, const void *addr, int nr)
        return file->f_op->write(file, addr, nr, &file->f_pos) == nr;
 }
 
-static int dump_seek(struct file *file, off_t off)
+static int dump_seek(struct file *file, loff_t off)
 {
        if (file->f_op->llseek) {
                if (file->f_op->llseek(file, off, 0) != off)
@@ -1301,7 +1300,7 @@ static void fill_prstatus(struct elf_prstatus *prstatus,
 static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p,
                       struct mm_struct *mm)
 {
-       int i, len;
+       unsigned int i, len;
        
        /* first copy the parameters from user space */
        memset(psinfo, 0, sizeof(struct elf_prpsinfo));
@@ -1502,9 +1501,7 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file)
        fill_psinfo(psinfo, current->group_leader, current->mm);
        fill_note(notes +1, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo);
        
-       fill_note(notes +2, "CORE", NT_TASKSTRUCT, sizeof(*current), current);
-  
-       numnote = 3;
+       numnote = 2;
 
        auxv = (elf_addr_t *) current->mm->saved_auxv;