summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--TODO4
-rw-r--r--src/ChangeLog4
-rw-r--r--src/elflint.c37
4 files changed, 45 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index e0414375..07d80a45 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ libcpu: Add Intel SSE4 disassembler support
5readelf: Implement call frame information and exception handling dumping. 5readelf: Implement call frame information and exception handling dumping.
6 Add -e option. Enable it implicitly for -a. 6 Add -e option. Enable it implicitly for -a.
7 7
8elflint: Check PT_GNU_EH_FRAME program header entry.
9
8libdwfl: Support automatic gzip/bzip2 decompression of ELF files. 10libdwfl: Support automatic gzip/bzip2 decompression of ELF files.
9 11
10Version 0.138: 12Version 0.138:
diff --git a/TODO b/TODO
index bc374146..c884c2c1 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,7 @@
1 ToDo list for elfutils -*-outline-*- 1 ToDo list for elfutils -*-outline-*-
2 ---------------------- 2 ----------------------
3 3
4Time-stamp: <2009-01-01 16:56:38 drepper> 4Time-stamp: <2009-01-16 20:55:06 drepper>
5 5
6* mkinstalldirs 6* mkinstalldirs
7 7
@@ -118,6 +118,8 @@ Time-stamp: <2009-01-01 16:56:38 drepper>
118 118
119 check TLS relocation depencies 119 check TLS relocation depencies
120 120
121 Check content of .eh_frame_hdr, .eh_frame, .gcc_except_table
122
121*** for x86 123*** for x86
122 124
123 check that R_386_TLS_GD is followed by R_386_PLT32 for __tls_get_addr 125 check that R_386_TLS_GD is followed by R_386_PLT32 for __tls_get_addr
diff --git a/src/ChangeLog b/src/ChangeLog
index ab13810e..4a9b6316 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
12009-01-16 Ulrich Drepper <drepper@redhat.com> 12009-01-16 Ulrich Drepper <drepper@redhat.com>
2 2
3 * elflint.c (check_program_header): Check that PT_GNU_EH_FRAME entry
4 matches .eh_frame_hdr section, if it is available. Also check that
5 the segment is allocated, not writable, not executable.
6
3 * readelf.c: Add -e option. Dump exception and unwind related 7 * readelf.c: Add -e option. Dump exception and unwind related
4 sections. Add -e to -a. 8 sections. Add -e to -a.
5 (print_encoding_base): Handle DW_EH_PE_omit. 9 (print_encoding_base): Handle DW_EH_PE_omit.
diff --git a/src/elflint.c b/src/elflint.c
index 23b0f496..35368a5e 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -4132,7 +4132,7 @@ more than one GNU_RELRO entry in program header\n"));
4132 if ((phdr2->p_flags & PF_W) == 0) 4132 if ((phdr2->p_flags & PF_W) == 0)
4133 ERROR (gettext ("\ 4133 ERROR (gettext ("\
4134loadable segment GNU_RELRO applies to is not writable\n")); 4134loadable segment GNU_RELRO applies to is not writable\n"));
4135 if ((phdr2->p_flags &~ PF_W) != (phdr->p_flags &~ PF_W)) 4135 if ((phdr2->p_flags & ~PF_W) != (phdr->p_flags & ~PF_W))
4136 ERROR (gettext ("\ 4136 ERROR (gettext ("\
4137loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n"), 4137loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n"),
4138 cnt, inner); 4138 cnt, inner);
@@ -4173,6 +4173,41 @@ loadable segment [%u] flags do not match GNU_RELRO [%u] flags\n"),
4173 ERROR (gettext ("\ 4173 ERROR (gettext ("\
4174program header offset in ELF header and PHDR entry do not match")); 4174program header offset in ELF header and PHDR entry do not match"));
4175 } 4175 }
4176 else if (phdr->p_type == PT_GNU_EH_FRAME)
4177 {
4178 /* If there is an .eh_frame_hdr section it must be
4179 referenced by this program header entry. */
4180 Elf_Scn *scn = NULL;
4181 while ((scn = elf_nextscn (ebl->elf, scn)) != NULL)
4182 {
4183 GElf_Shdr shdr_mem;
4184 GElf_Shdr *shdr = gelf_getshdr (scn, &shdr_mem);
4185 if (shdr != NULL && shdr->sh_type == SHT_PROGBITS
4186 && ! strcmp (".eh_frame_hdr",
4187 elf_strptr (ebl->elf, shstrndx, shdr->sh_name)))
4188 {
4189 if (phdr->p_offset != shdr->sh_offset)
4190 ERROR (gettext ("\
4191call frame search table reference in program header has wrong offset\n"));
4192 if (phdr->p_memsz != shdr->sh_size)
4193 ERROR (gettext ("\
4194call frame search table size mismatch in program and section header\n"));
4195 break;
4196 }
4197 }
4198
4199 /* The section must be allocated and not be writable and
4200 executable. */
4201 if ((phdr->p_flags & PF_R) == 0)
4202 ERROR (gettext ("\
4203call frame search table must be allocated\n"));
4204 if ((phdr->p_flags & PF_W) != 0)
4205 ERROR (gettext ("\
4206call frame search table must not be writable\n"));
4207 if ((phdr->p_flags & PF_X) != 0)
4208 ERROR (gettext ("\
4209call frame search table must not be executable\n"));
4210 }
4176 4211
4177 if (phdr->p_filesz > phdr->p_memsz 4212 if (phdr->p_filesz > phdr->p_memsz
4178 && (phdr->p_memsz != 0 || phdr->p_type != PT_NOTE)) 4213 && (phdr->p_memsz != 0 || phdr->p_type != PT_NOTE))