Re: [bug report] modpost: handle relocations mismatch in __ex_table.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 06, 2023 at 11:31:00AM +0300, Dan Carpenter wrote:
> [ 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.
> 

Oops, that is embarassing - thanks for catching that!

Have you already prepared a fix or shall I send it over?

Q


>     1155 }
> 
> regards,
> dan carpenter

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux