diff mbox series

fs/coredump: rate limit the unsafe core_pattern warning

Message ID 20220119222729.98545-1-colin.i.king@gmail.com (mailing list archive)
State New, archived
Headers show
Series fs/coredump: rate limit the unsafe core_pattern warning | expand

Commit Message

Colin Ian King Jan. 19, 2022, 10:27 p.m. UTC
It is possible to spam the kernel log with many invalid attempts
to set the core_pattern. Rate limit the warning message to make
it less spammy.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 fs/coredump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christian Brauner Jan. 20, 2022, 8:51 a.m. UTC | #1
On Wed, Jan 19, 2022 at 10:27:29PM +0000, Colin Ian King wrote:
> It is possible to spam the kernel log with many invalid attempts
> to set the core_pattern. Rate limit the warning message to make
> it less spammy.
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
> ---

Acked-by: Christian Brauner <brauner@kernel.org>
diff mbox series

Patch

diff --git a/fs/coredump.c b/fs/coredump.c
index 1c060c0a2d72..2dadc1dcaa2c 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -898,7 +898,7 @@  void validate_coredump_safety(void)
 {
 	if (suid_dumpable == SUID_DUMP_ROOT &&
 	    core_pattern[0] != '/' && core_pattern[0] != '|') {
-		pr_warn(
+		pr_warn_ratelimited(
 "Unsafe core_pattern used with fs.suid_dumpable=2.\n"
 "Pipe handler or fully qualified core dump path required.\n"
 "Set kernel.core_pattern before fs.suid_dumpable.\n"