linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kfence: defer kfence_test_init to ensure that kunit debugfs is created
@ 2021-07-14 11:31 Weizhao Ouyang
  2021-07-14 11:56 ` Marco Elver
  0 siblings, 1 reply; 2+ messages in thread
From: Weizhao Ouyang @ 2021-07-14 11:31 UTC (permalink / raw)
  To: glider, elver, dvyukov, akpm
  Cc: kasan-dev, linux-mm, linux-kernel, Weizhao Ouyang

kfence_test_init and kunit_init both use the same level late_initcall,
which means if kfence_test_init linked ahead of kunit_init,
kfence_test_init will get a NULL debugfs_rootdir as parent dentry,
then kfence_test_init and kfence_debugfs_init both create a debugfs
node named "kfence" under debugfs_mount->mnt_root, and it will throw
out "debugfs: Directory 'kfence' with parent '/' already present!" with
EEXIST. So kfence_test_init should be deferred.

Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
---
 mm/kfence/kfence_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/kfence/kfence_test.c b/mm/kfence/kfence_test.c
index 7f24b9bcb2ec..942cbc16ad26 100644
--- a/mm/kfence/kfence_test.c
+++ b/mm/kfence/kfence_test.c
@@ -852,7 +852,7 @@ static void kfence_test_exit(void)
 	tracepoint_synchronize_unregister();
 }
 
-late_initcall(kfence_test_init);
+late_initcall_sync(kfence_test_init);
 module_exit(kfence_test_exit);
 
 MODULE_LICENSE("GPL v2");
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kfence: defer kfence_test_init to ensure that kunit debugfs is created
  2021-07-14 11:31 [PATCH] kfence: defer kfence_test_init to ensure that kunit debugfs is created Weizhao Ouyang
@ 2021-07-14 11:56 ` Marco Elver
  0 siblings, 0 replies; 2+ messages in thread
From: Marco Elver @ 2021-07-14 11:56 UTC (permalink / raw)
  To: Weizhao Ouyang; +Cc: glider, dvyukov, akpm, kasan-dev, linux-mm, linux-kernel

On Wed, 14 Jul 2021 at 13:31, Weizhao Ouyang <o451686892@gmail.com> wrote:
> kfence_test_init and kunit_init both use the same level late_initcall,
> which means if kfence_test_init linked ahead of kunit_init,
> kfence_test_init will get a NULL debugfs_rootdir as parent dentry,
> then kfence_test_init and kfence_debugfs_init both create a debugfs
> node named "kfence" under debugfs_mount->mnt_root, and it will throw
> out "debugfs: Directory 'kfence' with parent '/' already present!" with
> EEXIST. So kfence_test_init should be deferred.
>
> Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>

Tested-by: Marco Elver <elver@google.com>

Thank you.

> ---
>  mm/kfence/kfence_test.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/kfence/kfence_test.c b/mm/kfence/kfence_test.c
> index 7f24b9bcb2ec..942cbc16ad26 100644
> --- a/mm/kfence/kfence_test.c
> +++ b/mm/kfence/kfence_test.c
> @@ -852,7 +852,7 @@ static void kfence_test_exit(void)
>         tracepoint_synchronize_unregister();
>  }
>
> -late_initcall(kfence_test_init);
> +late_initcall_sync(kfence_test_init);
>  module_exit(kfence_test_exit);
>
>  MODULE_LICENSE("GPL v2");
> --
> 2.30.2

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-14 11:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14 11:31 [PATCH] kfence: defer kfence_test_init to ensure that kunit debugfs is created Weizhao Ouyang
2021-07-14 11:56 ` Marco Elver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).