lkml.org 
[lkml]   [2005]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject[PATCH 2.6.11.2][0/2] printk with anti-cluttering-feature
These patches address the issue of dmesg being slowly spammed with 
repeated warnings.

Some parts of the kernel want to notify the user about deprecated or
invalid calls or parameters. These messages will slowly fill dmesg and
hinder you from seing the boot messages.

Examples are:
atkbd.c: Keyboard on isa0060/serio0 reports too many keys pressed.
(I'm using a keyboard switch and a IBM PS/2 keyboard)

program smartd is using a deprecated SCSI ioctl, please convert it to SG_IO
(I'll use the latest version as soon as I need to)

tuner: TV freq (0.00) out of range (44-958)
(I'll update zapping later)

This is prevented by introducing printk_nospam(), which takes an
additional magic value to identify the last one who printk-ed something.
If the current magic matches the one of the last successfull caller,
nothing will be printed. The normal printk will reset the magic to 0,
which ensures that if a messages indicating a current problem won't be
hidden just because it occured before.

Additionally, all these messages will be rate-limited, since they are
usurally triggered by userspace and thereby a way to DoS the machine.
Without the rate-limit, the user could repeatedly call two functions that
cause a printk in order to spam the log.

(The rate limit alone is not sufficient to prevent repeated warnings,
since they would be allowed by the burst limit or by being slow.)

This patch uses an uint, which can be read and written atomically by most
architectures. On architectures not supporting atomic reads to ints, the
message may be dropped or printed twice. I think it's OK, since dropping
for being racy is unlikely (especially compared to hitting the rate
limit), and a double line won't hurt.



The first patch will introduce the printk_nospam function.
The second patch will update the three printks causing my examples.

Since the TV freq message can be triggered by UID != 0, I'll send a hotfix
patch for the 2.6.11.x line, too. This patch is only compile-tested.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:11    [W:0.054 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site