1
0
Fork 0

kcsan, debugfs: Move debugfs file creation out of early init

commit e36299efe7 upstream.

Commit 56348560d4 ("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: 56348560d4 ("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>
pull/331/head^2
Marco Elver 2021-03-03 10:38:45 +01:00 committed by Greg Kroah-Hartman
parent d19555ff22
commit 5a876a46d7
3 changed files with 3 additions and 8 deletions

View 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();

View 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);

View 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.