load_elf_binary() should be more general

From: John Reiser (jreiser@BitWagon.com)
Date: Sat Apr 29 2000 - 15:03:18 EST


load_elf_binary() in fs/binfmt_elf.c ought to perform a more general mapping
of the file into memory, by zeroing a ".bss" area for each PT_LOAD whenever
p_filesz < p_memsz . Today, load_elf_binary() sets up only one .bss region
based on max(p_filesz + p_vaddr) < max(p_memsz + p_vaddr) , where each maximum
is performed independently over all PT_LOAD sections. In particular, today's
load_elf_binary() does not properly exec() a file with

Program Header:
    LOAD off 0x00000000 vaddr 0x00400000 paddr 0x00400000 align 2**12
         filesz 0x00003571 memsz 0x00004342 flags rwx
    LOAD off 0x00000734 vaddr 0x0804e734 paddr 0x0804e734 align 2**12
         filesz 0x00000000 memsz 0x00000000 flags rw-

as diagnosed by "objdump --private-headers". The memory space from (0x3571+0x400000)
to (0x4000+0x400000) is not zeroed, and the space from (0x4000+0x400000) to
(0x4342+0x400000) is not even allocated. The kernel reports no error on exec(),
but the process gets SIGSEGV when it touches (0x4000+0x400000).

-- 
John Reiser, jreiser@BitWagon.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Apr 30 2000 - 21:00:17 EST