From 83e8f4ba37fa7d2c3c43adf6651a642f05497b2e Mon Sep 17 00:00:00 2001 From: Nirjhar Roy Date: Mon, 9 Sep 2024 10:12:34 +0530 Subject: [PATCH] syscalls/_module: Rename /proc/dummy to module specific path name Tests in syscalls/delete_module/, syscalls/init_module and syscalls/finit_module use kernel modules all of which create a /proc/dummy node. When these tests run in parralel, there appears to be a situation where these tests simulatenously tries to create /proc/dummy node. This generates a kernel warning "proc_dir_entry '/proc/dummy' already registered". This patch renames the /proc/dummy node to module specific name in order to avoid the conflict. Signed-off-by: Nirjhar Roy Reviewed-by: Li Wang Reviewed-by: Avinesh Kumar Reviewed-by: Cyril Hrubis --- testcases/kernel/syscalls/delete_module/dummy_del_mod.c | 6 ++++-- testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c | 6 ++++-- testcases/kernel/syscalls/finit_module/finit_module.c | 6 ++++-- testcases/kernel/syscalls/init_module/init_module.c | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/testcases/kernel/syscalls/delete_module/dummy_del_mod.c b/testcases/kernel/syscalls/delete_module/dummy_del_mod.c index 0ca7bea37e3..4257bb5046a 100644 --- a/testcases/kernel/syscalls/delete_module/dummy_del_mod.c +++ b/testcases/kernel/syscalls/delete_module/dummy_del_mod.c @@ -14,6 +14,8 @@ #include #include +#define DIRNAME "dummy_delmod" + /* Dummy function called by dependent module */ int dummy_func_test(void) { @@ -25,13 +27,13 @@ static int __init dummy_init(void) { struct proc_dir_entry *proc_dummy; - proc_dummy = proc_mkdir("dummy", 0); + proc_dummy = proc_mkdir(DIRNAME, 0); return 0; } static void __exit dummy_exit(void) { - remove_proc_entry("dummy", 0); + remove_proc_entry(DIRNAME, 0); } module_init(dummy_init); diff --git a/testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c b/testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c index 85b327911cb..8c891cf49d4 100644 --- a/testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c +++ b/testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c @@ -16,20 +16,22 @@ #include #include +#define DIRNAME "dummy_dep" + extern int dummy_func_test(void); static int __init dummy_init(void) { struct proc_dir_entry *proc_dummy; - proc_dummy = proc_mkdir("dummy_dep", 0); + proc_dummy = proc_mkdir(DIRNAME, 0); dummy_func_test(); return 0; } static void __exit dummy_exit(void) { - remove_proc_entry("dummy_dep", 0); + remove_proc_entry(DIRNAME, 0); } module_init(dummy_init); diff --git a/testcases/kernel/syscalls/finit_module/finit_module.c b/testcases/kernel/syscalls/finit_module/finit_module.c index 78d03b899a7..a7b1e43c55e 100644 --- a/testcases/kernel/syscalls/finit_module/finit_module.c +++ b/testcases/kernel/syscalls/finit_module/finit_module.c @@ -13,6 +13,8 @@ #include #include +#define DIRNAME "dummy_finit" + static char status[20]; module_param_string(status, status, 20, 0444); @@ -23,14 +25,14 @@ static int dummy_init(void) if (!strcmp(status, "invalid")) return -EINVAL; - proc_dummy = proc_mkdir("dummy", 0); + proc_dummy = proc_mkdir(DIRNAME, 0); return 0; } module_init(dummy_init); static void dummy_exit(void) { - remove_proc_entry("dummy", 0); + remove_proc_entry(DIRNAME, 0); } module_exit(dummy_exit); diff --git a/testcases/kernel/syscalls/init_module/init_module.c b/testcases/kernel/syscalls/init_module/init_module.c index 78d03b899a7..f14cd80b6fb 100644 --- a/testcases/kernel/syscalls/init_module/init_module.c +++ b/testcases/kernel/syscalls/init_module/init_module.c @@ -13,6 +13,8 @@ #include #include +#define DIRNAME "dummy_init" + static char status[20]; module_param_string(status, status, 20, 0444); @@ -23,14 +25,14 @@ static int dummy_init(void) if (!strcmp(status, "invalid")) return -EINVAL; - proc_dummy = proc_mkdir("dummy", 0); + proc_dummy = proc_mkdir(DIRNAME, 0); return 0; } module_init(dummy_init); static void dummy_exit(void) { - remove_proc_entry("dummy", 0); + remove_proc_entry(DIRNAME, 0); } module_exit(dummy_exit);