public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] modpost: handle relocations mismatch in __ex_table.
@ 2023-06-06  8:31 Dan Carpenter
  2023-06-06  9:16 ` Masahiro Yamada
  2023-06-12  9:37 ` Quentin Casasnovas
  0 siblings, 2 replies; 5+ messages in thread
From: Dan Carpenter @ 2023-06-06  8:31 UTC (permalink / raw)
  To: quentin.casasnovas, Masahiro Yamada
  Cc: Nathan Chancellor, Nick Desaulniers, Nicolas Schier, linux-kbuild

[ Ancient code warning. - dan ]

Hello Quentin Casasnovas,

The patch 52dc0595d540: "modpost: handle relocations mismatch in
__ex_table." from Apr 13, 2015, leads to the following Smatch static
checker warning:

	./scripts/mod/modpost.c:1154 is_executable_section()
	warn: array off by one? 'elf->sechdrs[secndx]'

./scripts/mod/modpost.c
    1149 static bool is_executable_section(struct elf_info *elf, unsigned int secndx)
    1150 {
    1151         if (secndx > elf->num_sections)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
I'm not positive, but I think this should be >=.

    1152                 return false;
    1153 
--> 1154         return (elf->sechdrs[secndx].sh_flags & SHF_EXECINSTR) != 0;
                                      ^^^^^^
out of bounds read.

    1155 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-06-12 10:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-06  8:31 [bug report] modpost: handle relocations mismatch in __ex_table Dan Carpenter
2023-06-06  9:16 ` Masahiro Yamada
2023-06-12  9:37 ` Quentin Casasnovas
2023-06-12  9:51   ` Dan Carpenter
2023-06-12 10:22     ` Quentin Casasnovas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox