From: Christoph Hellwig Date: Wed, 14 May 2025 13:54:32 +0000 (+0200) Subject: module: remove CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fmissing-imports;p=users%2Fhch%2Fmisc.git module: remove CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS There is no point in bypassing the namespaces and undo the order they created. Anyone having problems had more than 5 years to sort them out. Signed-off-by: Christoph Hellwig --- diff --git a/Documentation/core-api/symbol-namespaces.rst b/Documentation/core-api/symbol-namespaces.rst index 06f766a6aab2..ca7cce745ecf 100644 --- a/Documentation/core-api/symbol-namespaces.rst +++ b/Documentation/core-api/symbol-namespaces.rst @@ -114,12 +114,9 @@ metadata definitions like MODULE_AUTHOR() or MODULE_LICENSE(). Refer to section At module loading time (e.g. ``insmod``), the kernel will check each symbol referenced from the module for its availability and whether the namespace it -might be exported to has been imported by the module. The default behaviour of -the kernel is to reject loading modules that don't specify sufficient imports. -An error will be logged and loading will be failed with EINVAL. In order to -allow loading of modules that don't satisfy this precondition, a configuration -option is available: Setting MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS=y will -enable loading regardless, but will emit a warning. +might be exported to has been imported by the module. The kernel rejects +loading modules that don't specify sufficient imports, an error will be logged +and loading will be failed with EINVAL. 5. Automatically creating MODULE_IMPORT_NS statements ===================================================== diff --git a/kernel/module/Kconfig b/kernel/module/Kconfig index d7762ef5949a..125ed4886bf3 100644 --- a/kernel/module/Kconfig +++ b/kernel/module/Kconfig @@ -400,19 +400,6 @@ config MODULE_DECOMPRESS If unsure, say N. -config MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS - bool "Allow loading of modules with missing namespace imports" - help - Symbols exported with EXPORT_SYMBOL_NS*() are considered exported in - a namespace. A module that makes use of a symbol exported with such a - namespace is required to import the namespace via MODULE_IMPORT_NS(""). - There is no technical reason to enforce correct namespace imports, - but it creates consistency between symbols defining namespaces and - users importing namespaces they make use of. This option relaxes this - requirement and lifts the enforcement when loading a module. - - If unsure, say N. - config MODPROBE_PATH string "Path to modprobe binary" default "/sbin/modprobe" diff --git a/kernel/module/main.c b/kernel/module/main.c index a2859dc3eea6..043b1bea531b 100644 --- a/kernel/module/main.c +++ b/kernel/module/main.c @@ -1096,16 +1096,10 @@ static int verify_namespace_is_imported(const struct load_info *info, if (strcmp(namespace, imported_namespace) == 0) return 0; } -#ifdef CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS - pr_warn( -#else pr_err( -#endif "%s: module uses symbol (%s) from namespace %s, but does not import it.\n", mod->name, kernel_symbol_name(sym), namespace); -#ifndef CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS return -EINVAL; -#endif } return 0; } diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index d7d45067d08b..95ebefe5b91d 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -49,7 +49,7 @@ modpost-args = \ $(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \ $(if $(KBUILD_MODPOST_WARN),-w) \ $(if $(KBUILD_NSDEPS),-d modules.nsdeps) \ - $(if $(CONFIG_MODULE_ALLOW_MISSING_NAMESPACE_IMPORTS)$(KBUILD_NSDEPS),-N) \ + $(if $(KBUILD_NSDEPS),-N) \ $(if $(findstring 1, $(KBUILD_EXTRA_WARN)),-W) \ -o $@