Skip to content

Commit

Permalink
syscalls/<delete, init, finit>_module: Rename /proc/dummy to module s…
Browse files Browse the repository at this point in the history
…pecific 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 <[email protected]>
Reviewed-by: Li Wang <[email protected]>
Reviewed-by: Avinesh Kumar <[email protected]>
Reviewed-by: Cyril Hrubis <[email protected]>
  • Loading branch information
Nirjhar Roy authored and metan-ucw committed Sep 17, 2024
1 parent 5568500 commit 83e8f4b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
6 changes: 4 additions & 2 deletions testcases/kernel/syscalls/delete_module/dummy_del_mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <linux/proc_fs.h>
#include <linux/kernel.h>

#define DIRNAME "dummy_delmod"

/* Dummy function called by dependent module */
int dummy_func_test(void)
{
Expand All @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions testcases/kernel/syscalls/delete_module/dummy_del_mod_dep.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,22 @@
#include <linux/proc_fs.h>
#include <linux/kernel.h>

#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);
Expand Down
6 changes: 4 additions & 2 deletions testcases/kernel/syscalls/finit_module/finit_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <linux/proc_fs.h>
#include <linux/kernel.h>

#define DIRNAME "dummy_finit"

static char status[20];
module_param_string(status, status, 20, 0444);

Expand All @@ -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);

Expand Down
6 changes: 4 additions & 2 deletions testcases/kernel/syscalls/init_module/init_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <linux/proc_fs.h>
#include <linux/kernel.h>

#define DIRNAME "dummy_init"

static char status[20];
module_param_string(status, status, 20, 0444);

Expand All @@ -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);

Expand Down

0 comments on commit 83e8f4b

Please sign in to comment.