diff options
author | Matthias Maennich <maennich@google.com> | 2019-09-06 06:32:29 -0400 |
---|---|---|
committer | Jessica Yu <jeyu@kernel.org> | 2019-09-10 04:30:27 -0400 |
commit | 3d52ec5e5d0dd7f8ca96a68c6756bd96e58b716b (patch) | |
tree | 51b5da97980203a40b9b1393ec5da9157d4d3215 /kernel/module.c | |
parent | cb9b55d21fe06ca5e4ba244bb5aac0afeb745c8e (diff) |
module: add config option MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS
If MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS is enabled (default=n), the
requirement for modules to import all namespaces that are used by
the module is relaxed.
Enabling this option effectively allows (invalid) modules to be loaded
while only a warning is emitted.
Disabling this option keeps the enforcement at module loading time and
loading is denied if the module's imports are not satisfactory.
Reviewed-by: Martijn Coenen <maco@android.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Matthias Maennich <maennich@google.com>
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/kernel/module.c b/kernel/module.c index 6bb9b938f9c7..f76efcf2043e 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -1408,9 +1408,16 @@ static int verify_namespace_is_imported(const struct load_info *info, | |||
1408 | imported_namespace = get_next_modinfo( | 1408 | imported_namespace = get_next_modinfo( |
1409 | info, "import_ns", imported_namespace); | 1409 | info, "import_ns", imported_namespace); |
1410 | } | 1410 | } |
1411 | pr_err("%s: module uses symbol (%s) from namespace %s, but does not import it.\n", | 1411 | #ifdef CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS |
1412 | mod->name, kernel_symbol_name(sym), namespace); | 1412 | pr_warn( |
1413 | #else | ||
1414 | pr_err( | ||
1415 | #endif | ||
1416 | "%s: module uses symbol (%s) from namespace %s, but does not import it.\n", | ||
1417 | mod->name, kernel_symbol_name(sym), namespace); | ||
1418 | #ifndef CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS | ||
1413 | return -EINVAL; | 1419 | return -EINVAL; |
1420 | #endif | ||
1414 | } | 1421 | } |
1415 | return 0; | 1422 | return 0; |
1416 | } | 1423 | } |