linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Walmsley <paul.walmsley@sifive.com>
To: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <michal.lkml@markovi.net>,
	Jim Wilson <jimw@sifive.com>, Paul Walmsley <paul@pwsan.com>
Subject: [PATCH 1/2] modpost: add switch to skip symbol exclusions likely to generate false positives
Date: Sat, 20 Oct 2018 06:19:12 -0700	[thread overview]
Message-ID: <20181020131911.22443-2-paul.walmsley@sifive.com> (raw)
In-Reply-To: <20181020131911.22443-1-paul.walmsley@sifive.com>

modpost uses symbol name whitelist patterns to determine whether
symbols should be excluded from section mismatch tests.  Since ELF
local symbols, empty symbol names, and ARM toolchain "magic" symbols
have autogenerated symbol names, they can trigger false positive
warnings for section mismatches, and are thus excluded from the
modpost section mismatch scan.  However, it seems useful to have the
option to include these autogenerated symbols in some section mismatch
scans, as an indicator that a patch set could require more attention
during review.  To that end, this patch adds a '-P' flag to modpost
that disables the filters that exclude autogenerated and empty symbol
names.

Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Michal Marek <michal.lkml@markovi.net>
Cc: Jim Wilson <jimw@sifive.com>
Cc: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Paul Walmsley <paul.walmsley@sifive.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
 scripts/mod/modpost.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 0d998c54564d..38fc1bd47926 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -39,6 +39,8 @@ static int sec_mismatch_verbose = 1;
 static int sec_mismatch_fatal = 0;
 /* ignore missing files */
 static int ignore_missing_files;
+/* accept checks which are more likely to generate false positives if set to 1 */
+static int accept_falsepos_risk;
 
 enum export {
 	export_plain,      export_unused,     export_gpl,
@@ -1292,7 +1294,7 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
 		symsec = sec_name(elf, get_secindex(elf, sym));
 		if (strcmp(symsec, sec) != 0)
 			continue;
-		if (!is_valid_name(elf, sym))
+		if (!accept_falsepos_risk && !is_valid_name(elf, sym))
 			continue;
 		if (sym->st_value <= addr) {
 			if ((addr - sym->st_value) < distance) {
@@ -2416,7 +2418,7 @@ int main(int argc, char **argv)
 	struct ext_sym_list *extsym_iter;
 	struct ext_sym_list *extsym_start = NULL;
 
-	while ((opt = getopt(argc, argv, "i:I:e:mnsST:o:awM:K:E")) != -1) {
+	while ((opt = getopt(argc, argv, "i:I:e:mnPsST:o:awM:K:E")) != -1) {
 		switch (opt) {
 		case 'i':
 			kernel_read = optarg;
@@ -2442,6 +2444,9 @@ int main(int argc, char **argv)
 		case 'o':
 			dump_write = optarg;
 			break;
+		case 'P':
+			accept_falsepos_risk = 1;
+			break;
 		case 'a':
 			all_versions = 1;
 			break;
-- 
2.19.1


  reply	other threads:[~2018-10-20 13:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-20 13:19 [PATCH 0/2] modpost: skip section mismatch warnings on ELF local symbols by default Paul Walmsley
2018-10-20 13:19 ` Paul Walmsley [this message]
2018-10-20 13:19 ` [PATCH 2/2] modpost: skip ELF local symbols by default during section mismatch check Paul Walmsley
2018-11-13  2:19   ` Masahiro Yamada
2018-11-14 19:30     ` Paul Walmsley
2018-10-20 14:08 ` [PATCH 0/2] modpost: skip section mismatch warnings on ELF local symbols by default Sam Ravnborg
2018-11-15  0:48   ` Paul Walmsley

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=20181020131911.22443-2-paul.walmsley@sifive.com \
    --to=paul.walmsley@sifive.com \
    --cc=jimw@sifive.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=paul@pwsan.com \
    --cc=yamada.masahiro@socionext.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).