Skip to content

Commit 9011e49

Browse files
Christoph Hellwigmcgrof
authored andcommitted
modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules
It has recently come to my attention that nvidia is circumventing the protection added in 262e6ae ("modules: inherit TAINT_PROPRIETARY_MODULE") by importing exports from their proprietary modules into an allegedly GPL licensed module and then rexporting them. Given that symbol_get was only ever intended for tightly cooperating modules using very internal symbols it is logical to restrict it to being used on EXPORT_SYMBOL_GPL and prevent nvidia from costly DMCA Circumvention of Access Controls law suites. All symbols except for four used through symbol_get were already exported as EXPORT_SYMBOL_GPL, and the remaining four ones were switched over in the preparation patches. Fixes: 262e6ae ("modules: inherit TAINT_PROPRIETARY_MODULE") Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
1 parent 95e7ebc commit 9011e49

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

kernel/module/main.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,12 +1295,20 @@ void *__symbol_get(const char *symbol)
12951295
};
12961296

12971297
preempt_disable();
1298-
if (!find_symbol(&fsa) || strong_try_module_get(fsa.owner)) {
1299-
preempt_enable();
1300-
return NULL;
1298+
if (!find_symbol(&fsa))
1299+
goto fail;
1300+
if (fsa.license != GPL_ONLY) {
1301+
pr_warn("failing symbol_get of non-GPLONLY symbol %s.\n",
1302+
symbol);
1303+
goto fail;
13011304
}
1305+
if (strong_try_module_get(fsa.owner))
1306+
goto fail;
13021307
preempt_enable();
13031308
return (void *)kernel_symbol_value(fsa.sym);
1309+
fail:
1310+
preempt_enable();
1311+
return NULL;
13041312
}
13051313
EXPORT_SYMBOL_GPL(__symbol_get);
13061314

0 commit comments

Comments
 (0)