aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/elf.h
diff options
context:
space:
mode:
authorDaisuke HATAYAMA <d.hatayama@jp.fujitsu.com>2010-03-05 16:44:10 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-06 14:26:46 -0500
commit8d9032bbe4671dc481261ccd4e161cd96e54b118 (patch)
treea31d22f488f7d6789259da68c53cb2727a925fa8 /include/linux/elf.h
parent93eb211e6c9ff6054fcf9c5b9e344d8d9ad29175 (diff)
elf coredump: add extended numbering support
The current ELF dumper implementation can produce broken corefiles if program headers exceed 65535. This number is determined by the number of vmas which the process have. In particular, some extreme programs may use more than 65535 vmas. (If you google max_map_count, you can find some users facing this problem.) This kind of program never be able to generate correct coredumps. This patch implements ``extended numbering'' that uses sh_info field of the first section header instead of e_phnum field in order to represent upto 4294967295 vmas. This is supported by AMD64-ABI(http://www.x86-64.org/documentation.html) and Solaris(http://docs.sun.com/app/docs/doc/817-1984/). Of course, we are preparing patches for gdb and binutils. Signed-off-by: Daisuke 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/elf.h')
-rw-r--r--include/linux/elf.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/include/linux/elf.h b/include/linux/elf.h
index ccde3fd45f36..597858418051 100644
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -50,6 +50,28 @@ typedef __s64 Elf64_Sxword;
50 50
51#define PT_GNU_STACK (PT_LOOS + 0x474e551) 51#define PT_GNU_STACK (PT_LOOS + 0x474e551)
52 52
53/*
54 * Extended Numbering
55 *
56 * If the real number of program header table entries is larger than
57 * or equal to PN_XNUM(0xffff), it is set to sh_info field of the
58 * section header at index 0, and PN_XNUM is set to e_phnum
59 * field. Otherwise, the section header at index 0 is zero
60 * initialized, if it exists.
61 *
62 * Specifications are available in:
63 *
64 * - Sun microsystems: Linker and Libraries.
65 * Part No: 817-1984-17, September 2008.
66 * URL: http://docs.sun.com/app/docs/doc/817-1984
67 *
68 * - System V ABI AMD64 Architecture Processor Supplement
69 * Draft Version 0.99.,
70 * May 11, 2009.
71 * URL: http://www.x86-64.org/
72 */
73#define PN_XNUM 0xffff
74
53/* These constants define the different elf file types */ 75/* These constants define the different elf file types */
54#define ET_NONE 0 76#define ET_NONE 0
55#define ET_REL 1 77#define ET_REL 1
@@ -286,7 +308,7 @@ typedef struct elf64_phdr {
286#define SHN_COMMON 0xfff2 308#define SHN_COMMON 0xfff2
287#define SHN_HIRESERVE 0xffff 309#define SHN_HIRESERVE 0xffff
288 310
289typedef struct { 311typedef struct elf32_shdr {
290 Elf32_Word sh_name; 312 Elf32_Word sh_name;
291 Elf32_Word sh_type; 313 Elf32_Word sh_type;
292 Elf32_Word sh_flags; 314 Elf32_Word sh_flags;
@@ -394,6 +416,7 @@ typedef struct elf64_note {
394extern Elf32_Dyn _DYNAMIC []; 416extern Elf32_Dyn _DYNAMIC [];
395#define elfhdr elf32_hdr 417#define elfhdr elf32_hdr
396#define elf_phdr elf32_phdr 418#define elf_phdr elf32_phdr
419#define elf_shdr elf32_shdr
397#define elf_note elf32_note 420#define elf_note elf32_note
398#define elf_addr_t Elf32_Off 421#define elf_addr_t Elf32_Off
399#define Elf_Half Elf32_Half 422#define Elf_Half Elf32_Half
@@ -403,6 +426,7 @@ extern Elf32_Dyn _DYNAMIC [];
403extern Elf64_Dyn _DYNAMIC []; 426extern Elf64_Dyn _DYNAMIC [];
404#define elfhdr elf64_hdr 427#define elfhdr elf64_hdr
405#define elf_phdr elf64_phdr 428#define elf_phdr elf64_phdr
429#define elf_shdr elf64_shdr
406#define elf_note elf64_note 430#define elf_note elf64_note
407#define elf_addr_t Elf64_Off 431#define elf_addr_t Elf64_Off
408#define Elf_Half Elf64_Half 432#define Elf_Half Elf64_Half