summaryrefslogtreecommitdiffstats
path: root/kernel/module
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2023-08-01 19:35:44 +0200
committerLuis Chamberlain <mcgrof@kernel.org>2023-08-02 20:18:22 +0200
commit9011e49d54dcc7653ebb8a1e05b5badb5ecfa9f9 (patch)
tree1ea03e99820893224b93715bf736f81898139d40 /kernel/module
parentrtc: ds1685: use EXPORT_SYMBOL_GPL for ds1685_rtc_poweroff (diff)
downloadlinux-9011e49d54dcc7653ebb8a1e05b5badb5ecfa9f9.tar.xz
linux-9011e49d54dcc7653ebb8a1e05b5badb5ecfa9f9.zip
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 262e6ae7081d ("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: 262e6ae7081d ("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>
Diffstat (limited to 'kernel/module')
-rw-r--r--kernel/module/main.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/module/main.c b/kernel/module/main.c
index 59b1d067e528..c395af9eced1 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -1295,12 +1295,20 @@ void *__symbol_get(const char *symbol)
};
preempt_disable();
- if (!find_symbol(&fsa) || strong_try_module_get(fsa.owner)) {
- preempt_enable();
- return NULL;
+ if (!find_symbol(&fsa))
+ goto fail;
+ if (fsa.license != GPL_ONLY) {
+ pr_warn("failing symbol_get of non-GPLONLY symbol %s.\n",
+ symbol);
+ goto fail;
}
+ if (strong_try_module_get(fsa.owner))
+ goto fail;
preempt_enable();
return (void *)kernel_symbol_value(fsa.sym);
+fail:
+ preempt_enable();
+ return NULL;
}
EXPORT_SYMBOL_GPL(__symbol_get);