• Daisuke HATAYAMA's avatar
    elf coredump: make offset calculation process and writing process explicit · 93eb211e
    Daisuke HATAYAMA authored
    By the next patch, elf_core_dump() and elf_fdpic_core_dump() will support
    extended numbering and so will produce the corefiles with section header
    table in a special case.
    
    The problem is the process of writing a file header offset of the section
    header table into e_shoff field of the ELF header.  ELF header is
    positioned at the beginning of the corefile, while section header at the
    end.  So, we need to take which of the following ways:
    
     1. Seek backward to retry writing operation for ELF header
        after writing process for a whole part
    
     2. Make offset calculation process and writing process
        totally sequential
    
    The clause 1.  is not always possible: one cannot assume that file system
    supports seek function.  Consider the no_llseek case.
    
    Therefore, this patch adopts the clause 2.
    Signed-off-by: default avatarDaisuke HATAYAMA <d.hatayama@jp.fujitsu.com>
    Cc: "Luck, Tony" <tony.luck@intel.com>
    Cc: Jeff Dike <jdike@addtoit.com>
    Cc: David Howells <dhowells@redhat.com>
    Cc: Greg Ungerer <gerg@snapgear.com>
    Cc: Roland McGrath <roland@redhat.com>
    Cc: Oleg Nesterov <oleg@redhat.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: Andi Kleen <andi@firstfloor.org>
    Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
    Cc: <linux-arch@vger.kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    93eb211e
binfmt_elf.c 52.4 KB