summaryrefslogtreecommitdiffstats
path: root/src/elflint.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2020-06-11 23:16:21 +0200
committerMark Wielaard <[email protected]>2020-06-11 23:16:21 +0200
commit50a6eeef7d87623faa65126dc3d16c2a8e613aea (patch)
tree19a35135efaac56c49a30316c6572c7b4d6ec4aa /src/elflint.c
parent49f13584d60322578c19b6118393ab04236ca7bf (diff)
parenta2bc0214a5615551d89cef8d160bdbaafd5f1a83 (diff)
Merge tag 'elfutils-0.180' into mjw/RH-DTSdts-0.180
elfutils 0.180 release
Diffstat (limited to 'src/elflint.c')
-rw-r--r--src/elflint.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/elflint.c b/src/elflint.c
index 684b794e..72584de0 100644
--- a/src/elflint.c
+++ b/src/elflint.c
@@ -658,6 +658,10 @@ section [%2d] '%s': symbol table cannot have more than one extended index sectio
ERROR (gettext ("\
section [%2u] '%s': entry size is does not match ElfXX_Sym\n"),
idx, section_name (ebl, idx));
+ else if (shdr->sh_info > shdr->sh_size / sh_entsize)
+ ERROR (gettext ("\
+section [%2u] '%s': number of local entries in 'st_info' larger than table size\n"),
+ idx, section_name (ebl, idx));
/* Test the zeroth entry. */
GElf_Sym sym_mem;
@@ -3917,6 +3921,11 @@ section [%2zu] '%s': size not multiple of entry size\n"),
GElf_Xword sh_flags = shdr->sh_flags & ~(GElf_Xword) ALL_SH_FLAGS;
if (sh_flags & SHF_MASKPROC)
{
+ /* Strictly speaking SHF_EXCLUDE is a processor specific
+ section flag, but it is used generically in the GNU
+ toolchain. */
+ if (gnuld)
+ sh_flags &= ~(GElf_Xword) SHF_EXCLUDE;
if (!ebl_machine_section_flag_check (ebl,
sh_flags & SHF_MASKPROC))
ERROR (gettext ("section [%2zu] '%s'"
@@ -4485,6 +4494,7 @@ only executables, shared objects, and core files can have program headers\n"));
if (phdr->p_type >= PT_NUM && phdr->p_type != PT_GNU_EH_FRAME
&& phdr->p_type != PT_GNU_STACK && phdr->p_type != PT_GNU_RELRO
+ && phdr->p_type != PT_GNU_PROPERTY
/* Check for a known machine-specific type. */
&& ebl_segment_type_name (ebl, phdr->p_type, NULL, 0) == NULL)
ERROR (gettext ("\
@@ -4761,7 +4771,14 @@ process_elf_file (Elf *elf, const char *prefix, const char *suffix,
ebl = ebl_openbackend (elf);
/* If there is no appropriate backend library we cannot test
architecture and OS specific features. Any encountered extension
- is an error. */
+ is an error. Often we'll get a "dummy" ebl, except if something
+ really bad happen, like a totally corrupted ELF file or out of
+ memory situation. */
+ if (ebl == NULL)
+ {
+ ERROR (gettext ("cannot create backend for ELF file\n"));
+ return;
+ }
/* Go straight by the gABI, check all the parts in turn. */
check_elf_header (ebl, ehdr, size);