]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
lockdown: ratelimit denial messages
authorNathan Lynch <nathanl@linux.ibm.com>
Thu, 8 Sep 2022 22:02:22 +0000 (17:02 -0500)
committerPaul Moore <paul@paul-moore.com>
Wed, 14 Sep 2022 11:37:50 +0000 (07:37 -0400)
User space can flood the log with lockdown denial messages:

[  662.555584] Lockdown: bash: debugfs access is restricted; see man kernel_lockdown.7
[  662.563237] Lockdown: bash: debugfs access is restricted; see man kernel_lockdown.7
[  662.571134] Lockdown: bash: debugfs access is restricted; see man kernel_lockdown.7
[  662.578668] Lockdown: bash: debugfs access is restricted; see man kernel_lockdown.7
[  662.586021] Lockdown: bash: debugfs access is restricted; see man kernel_lockdown.7
[  662.593398] Lockdown: bash: debugfs access is restricted; see man kernel_lockdown.7

Ratelimiting these shouldn't meaningfully degrade the quality of the
information logged.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
security/lockdown/lockdown.c

index 87cbdc64d272c72409bcb6f8f5e6a740ef95764a..a79b985e917ee642f1b9a7a8350b8a9fc26ff6c8 100644 (file)
@@ -63,7 +63,7 @@ static int lockdown_is_locked_down(enum lockdown_reason what)
 
        if (kernel_locked_down >= what) {
                if (lockdown_reasons[what])
-                       pr_notice("Lockdown: %s: %s is restricted; see man kernel_lockdown.7\n",
+                       pr_notice_ratelimited("Lockdown: %s: %s is restricted; see man kernel_lockdown.7\n",
                                  current->comm, lockdown_reasons[what]);
                return -EPERM;
        }