From: Roland McGrath Date: Wed, 11 Feb 2009 01:33:49 +0000 (-0800) Subject: Omit module sanity checks on offline modules. X-Git-Tag: elfutils-0.140~5^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5453abf2ab7626daeab2506ebc6ed067f5063eb4;p=thirdparty%2Felfutils.git Omit module sanity checks on offline modules. --- diff --git a/libdwfl/ChangeLog b/libdwfl/ChangeLog index fb235c93e..11e12a35f 100644 --- a/libdwfl/ChangeLog +++ b/libdwfl/ChangeLog @@ -1,5 +1,12 @@ 2009-02-10 Roland McGrath + * dwfl_report_elf.c (__libdwfl_report_elf): Take new arg SANITY. + If false, don't fail for NO_PHDR. + (dwfl_report_elf): Update caller. + * libdwflP.h: Update decl. + * offline.c (process_elf): Call it with false, so we don't refuse + dubiously-formed objects here. + * link_map.c (consider_executable): Don't assert dwfl_addrsegment finds our module. We shouldn't crash when we confuse some guesses. diff --git a/libdwfl/dwfl_report_elf.c b/libdwfl/dwfl_report_elf.c index 9fc156fe0..a58d30299 100644 --- a/libdwfl/dwfl_report_elf.c +++ b/libdwfl/dwfl_report_elf.c @@ -62,7 +62,7 @@ Dwfl_Module * internal_function __libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, - int fd, Elf *elf, GElf_Addr base) + int fd, Elf *elf, GElf_Addr base, bool sanity) { GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (elf, &ehdr_mem); if (ehdr == NULL) @@ -216,7 +216,7 @@ __libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, } } - if (end == 0) + if (end == 0 && sanity) { __libdwfl_seterrno (DWFL_E_NO_PHDR); return NULL; @@ -284,7 +284,7 @@ dwfl_report_elf (Dwfl *dwfl, const char *name, } Dwfl_Module *mod = __libdwfl_report_elf (dwfl, name, file_name, - fd, elf, base); + fd, elf, base, true); if (mod == NULL) { elf_end (elf); diff --git a/libdwfl/libdwflP.h b/libdwfl/libdwflP.h index 85519498d..45eac21cf 100644 --- a/libdwfl/libdwflP.h +++ b/libdwfl/libdwflP.h @@ -306,7 +306,7 @@ extern int __libdwfl_crc32_file (int fd, uint32_t *resp) attribute_hidden; Consumes ELF on success, not on failure. */ extern Dwfl_Module *__libdwfl_report_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd, - Elf *elf, GElf_Addr base) + Elf *elf, GElf_Addr base, bool sanity) internal_function; /* Meat of dwfl_report_offline. */ diff --git a/libdwfl/offline.c b/libdwfl/offline.c index a80e2928e..34aa9f84a 100644 --- a/libdwfl/offline.c +++ b/libdwfl/offline.c @@ -148,7 +148,7 @@ process_elf (Dwfl *dwfl, const char *name, const char *file_name, int fd, Elf *elf) { Dwfl_Module *mod = __libdwfl_report_elf (dwfl, name, file_name, fd, elf, - dwfl->offline_next_address); + dwfl->offline_next_address, false); if (mod != NULL) { /* If this is an ET_EXEC file with fixed addresses, the address range