Skip to content

Commit

Permalink
modules: only allow symbol_get of EXPORT_SYMBOL_GPL modules
Browse files Browse the repository at this point in the history
commit 9011e49 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Christoph Hellwig authored and gregkh committed Sep 6, 2023
1 parent 36231e2 commit 5d0fe30
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions kernel/module/main.c
Expand Up @@ -1214,12 +1214,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);

Expand Down

0 comments on commit 5d0fe30

Please sign in to comment.