All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: quentin.casasnovas@oracle.com, Masahiro Yamada <masahiroy@kernel.org>
Cc: Nathan Chancellor <nathan@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Nicolas Schier <nicolas@fjasle.eu>,
	linux-kbuild@vger.kernel.org
Subject: [bug report] modpost: handle relocations mismatch in __ex_table.
Date: Tue, 6 Jun 2023 11:31:00 +0300	[thread overview]
Message-ID: <ZH7uxFaLhjul0jp1@moroto> (raw)

[ 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

             reply	other threads:[~2023-06-06  8:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-06  8:31 Dan Carpenter [this message]
2023-06-06  9:16 ` [bug report] modpost: handle relocations mismatch in __ex_table Masahiro Yamada
2023-06-12  9:37 ` Quentin Casasnovas
2023-06-12  9:51   ` Dan Carpenter
2023-06-12 10:22     ` Quentin Casasnovas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZH7uxFaLhjul0jp1@moroto \
    --to=dan.carpenter@linaro.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=quentin.casasnovas@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.