* [PATCH] module: show disallowed symbol name for inherit_taint()
@ 2022-04-26 4:21 Lecopzer Chen
2022-04-26 16:26 ` Luis Chamberlain
0 siblings, 1 reply; 3+ messages in thread
From: Lecopzer Chen @ 2022-04-26 4:21 UTC (permalink / raw)
To: Luis Chamberlain, linux-kernel
Cc: Matthias Brugger, linux-modules, linux-mediatek, yj.chiang,
lecopzer.chen
The error log for inherit_taint() doesn't really help to find the symbols
which violate GPL rules.
For example,
if a module has 50 disallowed symbols, the log only shows the content below
and is duplicated with 50 lines.
AAA: module using GPL-only symbols uses symbols from proprietary module BBB.
AAA: module using GPL-only symbols uses symbols from proprietary module BBB.
...
This patch add symbol name to tell the offending symbols explicitly.
To-be:
AAA: module using GPL-only symbols uses symbols SS1 from proprietary module BBB.
AAA: module using GPL-only symbols uses symbols SS2 from proprietary module BBB.
...
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
---
kernel/module.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/module.c b/kernel/module.c
index 6cea788fd965..30973f0d2b7c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1372,20 +1372,20 @@ static int verify_namespace_is_imported(const struct load_info *info,
return 0;
}
-static bool inherit_taint(struct module *mod, struct module *owner)
+static bool inherit_taint(struct module *mod, struct module *owner, const char *name)
{
if (!owner || !test_bit(TAINT_PROPRIETARY_MODULE, &owner->taints))
return true;
if (mod->using_gplonly_symbols) {
- pr_err("%s: module using GPL-only symbols uses symbols from proprietary module %s.\n",
- mod->name, owner->name);
+ pr_err("%s: module using GPL-only symbols uses symbols %s from proprietary module %s.\n",
+ mod->name, name, owner->name);
return false;
}
if (!test_bit(TAINT_PROPRIETARY_MODULE, &mod->taints)) {
- pr_warn("%s: module uses symbols from proprietary module %s, inheriting taint.\n",
- mod->name, owner->name);
+ pr_warn("%s: module uses symbols %s from proprietary module %s, inheriting taint.\n",
+ mod->name, name, owner->name);
set_bit(TAINT_PROPRIETARY_MODULE, &mod->taints);
}
return true;
@@ -1417,7 +1417,7 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod,
if (fsa.license == GPL_ONLY)
mod->using_gplonly_symbols = true;
- if (!inherit_taint(mod, fsa.owner)) {
+ if (!inherit_taint(mod, fsa.owner, name)) {
fsa.sym = NULL;
goto getname;
}
--
2.18.0
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] module: show disallowed symbol name for inherit_taint()
2022-04-26 4:21 [PATCH] module: show disallowed symbol name for inherit_taint() Lecopzer Chen
@ 2022-04-26 16:26 ` Luis Chamberlain
2022-04-27 7:40 ` Lecopzer Chen
0 siblings, 1 reply; 3+ messages in thread
From: Luis Chamberlain @ 2022-04-26 16:26 UTC (permalink / raw)
To: Lecopzer Chen, atomlin
Cc: linux-kernel, Matthias Brugger, linux-modules, linux-mediatek,
yj.chiang
Can you base your changes on modules-next [0] and resend and Cc
atomlin@redhat.com?
[0] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/log/?h=modules-next
Luis
On Tue, Apr 26, 2022 at 12:21:20PM +0800, Lecopzer Chen wrote:
> The error log for inherit_taint() doesn't really help to find the symbols
> which violate GPL rules.
>
> For example,
> if a module has 50 disallowed symbols, the log only shows the content below
> and is duplicated with 50 lines.
> AAA: module using GPL-only symbols uses symbols from proprietary module BBB.
> AAA: module using GPL-only symbols uses symbols from proprietary module BBB.
> ...
>
> This patch add symbol name to tell the offending symbols explicitly.
>
> To-be:
> AAA: module using GPL-only symbols uses symbols SS1 from proprietary module BBB.
> AAA: module using GPL-only symbols uses symbols SS2 from proprietary module BBB.
> ...
>
> Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
> ---
> kernel/module.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/module.c b/kernel/module.c
> index 6cea788fd965..30973f0d2b7c 100644
> --- a/kernel/module.c
> +++ b/kernel/module.c
> @@ -1372,20 +1372,20 @@ static int verify_namespace_is_imported(const struct load_info *info,
> return 0;
> }
>
> -static bool inherit_taint(struct module *mod, struct module *owner)
> +static bool inherit_taint(struct module *mod, struct module *owner, const char *name)
> {
> if (!owner || !test_bit(TAINT_PROPRIETARY_MODULE, &owner->taints))
> return true;
>
> if (mod->using_gplonly_symbols) {
> - pr_err("%s: module using GPL-only symbols uses symbols from proprietary module %s.\n",
> - mod->name, owner->name);
> + pr_err("%s: module using GPL-only symbols uses symbols %s from proprietary module %s.\n",
> + mod->name, name, owner->name);
> return false;
> }
>
> if (!test_bit(TAINT_PROPRIETARY_MODULE, &mod->taints)) {
> - pr_warn("%s: module uses symbols from proprietary module %s, inheriting taint.\n",
> - mod->name, owner->name);
> + pr_warn("%s: module uses symbols %s from proprietary module %s, inheriting taint.\n",
> + mod->name, name, owner->name);
> set_bit(TAINT_PROPRIETARY_MODULE, &mod->taints);
> }
> return true;
> @@ -1417,7 +1417,7 @@ static const struct kernel_symbol *resolve_symbol(struct module *mod,
> if (fsa.license == GPL_ONLY)
> mod->using_gplonly_symbols = true;
>
> - if (!inherit_taint(mod, fsa.owner)) {
> + if (!inherit_taint(mod, fsa.owner, name)) {
> fsa.sym = NULL;
> goto getname;
> }
> --
> 2.18.0
>
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] module: show disallowed symbol name for inherit_taint()
2022-04-26 16:26 ` Luis Chamberlain
@ 2022-04-27 7:40 ` Lecopzer Chen
0 siblings, 0 replies; 3+ messages in thread
From: Lecopzer Chen @ 2022-04-27 7:40 UTC (permalink / raw)
To: mcgrof
Cc: atomlin, lecopzer.chen, linux-kernel, linux-mediatek,
linux-modules, matthias.bgg, yj.chiang
> Can you base your changes on modules-next [0] and resend and Cc
> atomlin@redhat.com?
>
> [0] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux.git/log/?h=modules-next
>
> Luis
>
I've rebased on modules-next and resend [1].
[1] https://lore.kernel.org/lkml/20220427073606.29752-1-lecopzer.chen@mediatek.com/
thanks,
Lecopzer
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-04-27 7:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-26 4:21 [PATCH] module: show disallowed symbol name for inherit_taint() Lecopzer Chen
2022-04-26 16:26 ` Luis Chamberlain
2022-04-27 7:40 ` Lecopzer Chen
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).