To align with the kernel's established coding style guide regarding
naming conventions (i.e., Documentation/process/coding-style.rst),
migrate the internal module_blacklist variables and helper functions to
module_denylist and module_is_denylisted().

To preserve the existing user-space ABI and ensure backward
compatibility with existing bootloader and automated provisioning
configurations, "module_blacklist=" is retained as a legacy alias
tracking the underlying module_denylist infrastructure.

Signed-off-by: Aaron Tomlin <[email protected]>
---
 include/linux/module.h |  2 +-
 init/main.c            | 17 +++++++++--------
 kernel/module/main.c   |  4 ++--
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index fc1525e8f63c..e83ce13e6db5 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -884,7 +884,7 @@ static inline void module_for_each_mod(int(*func)(struct 
module *mod, void *data
 }
 #endif /* CONFIG_MODULES */
 
-bool module_is_blacklisted(const char *module_name);
+bool module_is_denylisted(const char *module_name);
 
 #ifdef CONFIG_SYSFS
 extern struct kset *module_kset;
diff --git a/init/main.c b/init/main.c
index 0cf64d19b43f..18291e9bab41 100644
--- a/init/main.c
+++ b/init/main.c
@@ -1337,17 +1337,17 @@ static inline void do_trace_initcall_level(const char 
*level)
 extern struct initcall_modname __start_initcall_modnames[];
 extern struct initcall_modname __stop_initcall_modnames[];
 
-/* module_blacklist is a comma-separated list of module names */
-static char *module_blacklist;
-bool __init_or_module module_is_blacklisted(const char *module_name)
+/* module_denylist is a comma-separated list of module names */
+static char *module_denylist;
+bool __init_or_module module_is_denylisted(const char *module_name)
 {
        const char *p;
        size_t len;
 
-       if (!module_blacklist)
+       if (!module_denylist)
                return false;
 
-       for (p = module_blacklist; *p; p += len) {
+       for (p = module_denylist; *p; p += len) {
                len = strcspn(p, ",");
                if (strlen(module_name) == len && !memcmp(module_name, p, len))
                        return true;
@@ -1356,7 +1356,8 @@ bool __init_or_module module_is_blacklisted(const char 
*module_name)
        }
        return false;
 }
-core_param(module_blacklist, module_blacklist, charp, 0400);
+core_param(module_denylist, module_denylist, charp, 0400);
+core_param(module_blacklist, module_denylist, charp, 0400);
 
 static const char *__init get_builtin_modname(initcall_t fn)
 {
@@ -1377,9 +1378,9 @@ int __init_or_module do_one_initcall(initcall_t fn)
        const char *modname = NULL;
        int ret;
 
-       if (system_state < SYSTEM_FREEING_INITMEM && module_blacklist) {
+       if (system_state < SYSTEM_FREEING_INITMEM && module_denylist) {
                modname = get_builtin_modname(fn);
-               if (modname && module_is_blacklisted(modname)) {
+               if (modname && module_is_denylisted(modname)) {
                        pr_info("Skipping initcall for blacklisted built-in 
module %s\n",
                                modname);
                        return 0;
diff --git a/kernel/module/main.c b/kernel/module/main.c
index 5c90ebedbf68..e6d9c52b9786 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -3369,9 +3369,9 @@ static int early_mod_check(struct load_info *info, int 
flags)
 
        /*
         * Now that we know we have the correct module name, check
-        * if it's blacklisted.
+        * if it's denylisted.
         */
-       if (module_is_blacklisted(info->name)) {
+       if (module_is_denylisted(info->name)) {
                pr_err("Module %s is blacklisted\n", info->name);
                return -EPERM;
        }
-- 
2.54.0


Reply via email to