From: Matthew Garrett <mjg59@google.com>
To: jeyu@redhat.com
Cc: linux-kernel@vger.kernel.org, Matthew Garrett <mjg59@google.com>
Subject: [PATCH] modpost: List all GPL-only symbols used by GPL-incompatible modules
Date: Tue, 30 Jan 2018 11:01:36 -0800 [thread overview]
Message-ID: <20180130190136.46491-1-mjg59@google.com> (raw)
modpost currently exits after hitting the first GPL-only symbol used by
a GPL-incompatible module. Delay the failure until all symbols have been
processed in order to print all cases rather than just the first.
Signed-off-by: Matthew Garrett <mjg59@google.com>
---
scripts/mod/modpost.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index f51cf977c65b..2daa66e4569c 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2056,29 +2056,30 @@ void buf_write(struct buffer *buf, const char *s, int len)
buf->pos += len;
}
-static void check_for_gpl_usage(enum export exp, const char *m, const char *s)
+static int check_for_gpl_usage(enum export exp, const char *m, const char *s)
{
const char *e = is_vmlinux(m) ?"":".ko";
switch (exp) {
case export_gpl:
- fatal("modpost: GPL-incompatible module %s%s "
+ warn("modpost: GPL-incompatible module %s%s "
"uses GPL-only symbol '%s'\n", m, e, s);
- break;
+ return 1;
case export_unused_gpl:
- fatal("modpost: GPL-incompatible module %s%s "
+ warn("modpost: GPL-incompatible module %s%s "
"uses GPL-only symbol marked UNUSED '%s'\n", m, e, s);
- break;
+ return 1;
case export_gpl_future:
warn("modpost: GPL-incompatible module %s%s "
"uses future GPL-only symbol '%s'\n", m, e, s);
- break;
+ return 0;
case export_plain:
case export_unused:
case export_unknown:
/* ignore */
- break;
+ return 0;
}
+ return 0;
}
static void check_for_unused(enum export exp, const char *m, const char *s)
@@ -2100,6 +2101,7 @@ static void check_for_unused(enum export exp, const char *m, const char *s)
static void check_exports(struct module *mod)
{
struct symbol *s, *exp;
+ int symbol_mismatch = 0;
for (s = mod->unres; s; s = s->next) {
const char *basename;
@@ -2111,10 +2113,13 @@ static void check_exports(struct module *mod)
basename++;
else
basename = mod->name;
- if (!mod->gpl_compatible)
- check_for_gpl_usage(exp->export, basename, exp->name);
+ if (!mod->gpl_compatible &&
+ check_for_gpl_usage(exp->export, basename, exp->name))
+ symbol_mismatch = 1;
check_for_unused(exp->export, basename, exp->name);
}
+ if (symbol_mismatch)
+ fatal("Module violates symbol usage policy\n");
}
static int check_modname_len(struct module *mod)
--
2.16.0.rc1.238.g530d649a79-goog
reply other threads:[~2018-01-30 19:01 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20180130190136.46491-1-mjg59@google.com \
--to=mjg59@google.com \
--cc=jeyu@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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
Powered by JetHome