Skip to content

Commit 8eac910

Browse files
Lecopzer Chenmcgrof
authored andcommitted
module: show disallowed symbol name for inherit_taint()
The error log for inherit_taint() doesn't really help to find the symbol which violates GPL rules. For example, if a module has 300 symbol and includes 50 disallowed symbols, the log only shows the content below and we have no idea what symbol is. AAA: module using GPL-only symbols uses symbols from proprietary module BBB. It's hard for user who doesn't really know how the symbol was parsing. This patch add symbol name to tell the offending symbols explicitly. AAA: module using GPL-only symbols uses symbols SSS from proprietary module BBB. Signed-off-by: Lecopzer Chen <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 391e982 commit 8eac910

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

kernel/module/main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,20 +1038,20 @@ static int verify_namespace_is_imported(const struct load_info *info,
10381038
return 0;
10391039
}
10401040

1041-
static bool inherit_taint(struct module *mod, struct module *owner)
1041+
static bool inherit_taint(struct module *mod, struct module *owner, const char *name)
10421042
{
10431043
if (!owner || !test_bit(TAINT_PROPRIETARY_MODULE, &owner->taints))
10441044
return true;
10451045

10461046
if (mod->using_gplonly_symbols) {
1047-
pr_err("%s: module using GPL-only symbols uses symbols from proprietary module %s.\n",
1048-
mod->name, owner->name);
1047+
pr_err("%s: module using GPL-only symbols uses symbols %s from proprietary module %s.\n",
1048+
mod->name, name, owner->name);
10491049
return false;
10501050
}
10511051

10521052
if (!test_bit(TAINT_PROPRIETARY_MODULE, &mod->taints)) {
1053-
pr_warn("%s: module uses symbols from proprietary module %s, inheriting taint.\n",
1054-
mod->name, owner->name);
1053+
pr_warn("%s: module uses symbols %s from proprietary module %s, inheriting taint.\n",
1054+
mod->name, name, owner->name);
10551055
set_bit(TAINT_PROPRIETARY_MODULE, &mod->taints);
10561056
}
10571057
return true;
@@ -1083,7 +1083,7 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod,
10831083
if (fsa.license == GPL_ONLY)
10841084
mod->using_gplonly_symbols = true;
10851085

1086-
if (!inherit_taint(mod, fsa.owner)) {
1086+
if (!inherit_taint(mod, fsa.owner, name)) {
10871087
fsa.sym = NULL;
10881088
goto getname;
10891089
}

0 commit comments

Comments
 (0)