]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
kcsan, debugfs: Move debugfs file creation out of early init
authorMarco Elver <elver@google.com>
Wed, 3 Mar 2021 09:38:45 +0000 (10:38 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 19 May 2021 08:32:20 +0000 (10:32 +0200)
BugLink: https://bugs.launchpad.net/bugs/1928857
commit e36299efe7d749976fbdaaf756dee6ef32543c2c upstream.

Commit 56348560d495 ("debugfs: do not attempt to create a new file
before the filesystem is initalized") forbids creating new debugfs files
until debugfs is fully initialized.  This means that KCSAN's debugfs
file creation, which happened at the end of __init(), no longer works.
And was apparently never supposed to work!

However, there is no reason to create KCSAN's debugfs file so early.
This commit therefore moves its creation to a late_initcall() callback.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: stable <stable@vger.kernel.org>
Fixes: 56348560d495 ("debugfs: do not attempt to create a new file before the filesystem is initalized")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
kernel/kcsan/core.c
kernel/kcsan/debugfs.c
kernel/kcsan/kcsan.h

index 3bf98db9c702da58e6967d042dff45181c82020c..23e7acb5c66798c829e57f3602c3e61bb7a476fc 100644 (file)
@@ -639,8 +639,6 @@ void __init kcsan_init(void)
 
        BUG_ON(!in_task());
 
-       kcsan_debugfs_init();
-
        for_each_possible_cpu(cpu)
                per_cpu(kcsan_rand_state, cpu) = (u32)get_cycles();
 
index 3c8093a371b1c171eb0a5c8a72011c183c9fc03d..209ad8dcfcecfaec0f9c4244baad813de7bb0a4b 100644 (file)
@@ -261,7 +261,9 @@ static const struct file_operations debugfs_ops =
        .release = single_release
 };
 
-void __init kcsan_debugfs_init(void)
+static void __init kcsan_debugfs_init(void)
 {
        debugfs_create_file("kcsan", 0644, NULL, NULL, &debugfs_ops);
 }
+
+late_initcall(kcsan_debugfs_init);
index 8d4bf3431b3cc78a76e880e87c0b32656473fbac..87ccdb3b051fd7f9d66b6686ca8ded2b8ebaf502 100644 (file)
@@ -30,11 +30,6 @@ extern bool kcsan_enabled;
 void kcsan_save_irqtrace(struct task_struct *task);
 void kcsan_restore_irqtrace(struct task_struct *task);
 
-/*
- * Initialize debugfs file.
- */
-void kcsan_debugfs_init(void);
-
 /*
  * Statistics counters displayed via debugfs; should only be modified in
  * slow-paths.