diff options
Diffstat (limited to 'usr/src')
-rw-r--r-- | usr/src/cmd/sgs/elfdump/common/elfdump.c | 13 | ||||
-rw-r--r-- | usr/src/cmd/sgs/elfdump/common/elfdump.msg | 2 | ||||
-rw-r--r-- | usr/src/cmd/sgs/packages/common/SUNWonld-README | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.c b/usr/src/cmd/sgs/elfdump/common/elfdump.c index ce03a0f556..66897fc87e 100644 --- a/usr/src/cmd/sgs/elfdump/common/elfdump.c +++ b/usr/src/cmd/sgs/elfdump/common/elfdump.c @@ -2584,7 +2584,7 @@ got(Cache *cache, Word shnum, Ehdr *ehdr, const char *file, uint_t flags) /* * Only pay attention to relocations against the GOT. */ - if ((offset < gotbgn) || (offset > gotend)) + if ((offset < gotbgn) || (offset >= gotend)) continue; /* LINTED */ @@ -2697,6 +2697,17 @@ regular(const char *file, Elf *elf, uint_t flags, char *Nname, int wfd) Elf_ehdr(0, ehdr, shdr); /* + * If the section headers or program headers have inadequate + * alignment for the class of object, print a warning. libelf + * can handle such files, but programs that use them can crash + * when they dereference unaligned items. + */ + if (ehdr->e_phoff & (sizeof (Addr) - 1)) + (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADPHDRALIGN), file); + if (ehdr->e_shoff & (sizeof (Addr) - 1)) + (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHDRALIGN), file); + + /* * Print the program headers. */ if ((flags & FLG_PHDR) && (phnum != 0)) { diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.msg b/usr/src/cmd/sgs/elfdump/common/elfdump.msg index f8adc9cab2..998aa416e2 100644 --- a/usr/src/cmd/sgs/elfdump/common/elfdump.msg +++ b/usr/src/cmd/sgs/elfdump/common/elfdump.msg @@ -73,6 +73,8 @@ @ MSG_ERR_BADREL1 "%s: bad relocation entry: %s: relocation requires symbol\n" @ MSG_ERR_SHSTRNULL "%s: zero size section header string table (shstrtab)\n" @ MSG_ERR_FAILURE "%s: %s failed: %s\n" +@ MSG_ERR_BADSHDRALIGN "%s: bad section header array alignment\n" +@ MSG_ERR_BADPHDRALIGN "%s: bad program header array alignment\n" @ MSG_ERR_BADSHNAME "%s: section[%d]: invalid sh_name: %lld\n" @ MSG_ERR_BADSHLINK "%s: %s: invalid sh_link: %d\n" @ MSG_ERR_BADSHINFO "%s: %s: invalid sh_info: %d\n" diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README index 939f727235..65aa2ff620 100644 --- a/usr/src/cmd/sgs/packages/common/SUNWonld-README +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README @@ -1229,3 +1229,5 @@ Bugid Risk Synopsis 6541004 hwcap filter processing can leak memory 5108874 elfdump SEGVs on bad object file 6547441 Uninitialized variable causes ld.so.1 to crash on object cleanup +6341667 elfdump should check alignments of ELF header elements +6387860 elfdump cores, when processing linux built ELF file |