Skip to content

Commit 489a719

Browse files
committed
clk: Emit a stern warning with writable debugfs enabled
We don't want vendors to be enabling this part of the clk code and shipping it to customers. Exposing the ability to change clk frequencies and parents via debugfs is potentially damaging to the system if folks don't know what they're doing. Emit a strong warning so that the message is clear: don't enable this outside of development systems. Fixes: 37215da ("clk: Add support for setting clk_rate via debugfs") Cc: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20211210014237.2130300-1-sboyd@kernel.org Signed-off-by: Stephen Boyd <sboyd@kernel.org>
1 parent a331659 commit 489a719

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

drivers/clk/clk.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3383,6 +3383,24 @@ static int __init clk_debug_init(void)
33833383
{
33843384
struct clk_core *core;
33853385

3386+
#ifdef CLOCK_ALLOW_WRITE_DEBUGFS
3387+
pr_warn("\n");
3388+
pr_warn("********************************************************************\n");
3389+
pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n");
3390+
pr_warn("** **\n");
3391+
pr_warn("** WRITEABLE clk DebugFS SUPPORT HAS BEEN ENABLED IN THIS KERNEL **\n");
3392+
pr_warn("** **\n");
3393+
pr_warn("** This means that this kernel is built to expose clk operations **\n");
3394+
pr_warn("** such as parent or rate setting, enabling, disabling, etc. **\n");
3395+
pr_warn("** to userspace, which may compromise security on your system. **\n");
3396+
pr_warn("** **\n");
3397+
pr_warn("** If you see this message and you are not debugging the **\n");
3398+
pr_warn("** kernel, report this immediately to your vendor! **\n");
3399+
pr_warn("** **\n");
3400+
pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n");
3401+
pr_warn("********************************************************************\n");
3402+
#endif
3403+
33863404
rootdir = debugfs_create_dir("clk", NULL);
33873405

33883406
debugfs_create_file("clk_summary", 0444, rootdir, &all_lists,

0 commit comments

Comments
 (0)