Re: [PATCH 8/8] modules: inherit TAINT_PROPRIETARY_MODULE

From: Christoph Hellwig
Date: Thu Jul 30 2020 - 12:30:02 EST


On Thu, Jul 30, 2020 at 04:12:32PM +0200, Jessica Yu wrote:
>> + if (owner && test_bit(TAINT_PROPRIETARY_MODULE, &owner->taints)) {
>> + if (mod->using_gplonly_symbols) {
>> + sym = NULL;
>> + goto getname;
>> + }
>> + add_taint_module(mod, TAINT_PROPRIETARY_MODULE,
>> + LOCKDEP_NOW_UNRELIABLE);
>> + }
>
> Sorry that I didn't think of this yesterday, but I'm wondering if we
> should print a warning before add_taint_module(). Maybe something
> along the lines of, "%s: module uses symbols from proprietary module
> %s, inheriting taint.", with %s being mod->name, owner->name. We can
> check mod->taints for TAINT_PROPRIETARY_MODULE and print the warning once.
>
> Additionally, maybe it's a good idea to print an error before goto
> getname (e.g., "%s: module using GPL-only symbols uses symbols from
> proprietary module %s."), so one would know why the module load
> failed, right now this manifests itself as an unknown symbol error.
>
> Otherwise, this patchset looks good to me and I agree with it in
> principle. Thanks Christoph!

What about this version? It also factors the code out into a new
helper, and replaces the add_taint_module with a simple set_bit,
as the system-wide tain must have been set before by definition:

---