[PATCH] x86_64: Check for bad elf entry address.
authorSuresh Siddha <suresh.b.siddha@intel.com>
Sun, 26 Feb 2006 03:18:28 +0000 (04:18 +0100)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 26 Feb 2006 17:53:30 +0000 (09:53 -0800)
Fixes a local DOS on Intel systems that lead to an endless
recursive fault.  AMD machines don't seem to be affected.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/binfmt_elf.c

index 1b117a4..c2eac2a 100644 (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);