• Borislav Petkov's avatar
    printk: add kernel parameter to control writes to /dev/kmsg · 750afe7b
    Borislav Petkov authored
    Add a "printk.devkmsg" kernel command line parameter which controls how
    userspace writes into /dev/kmsg.  It has three options:
    
     * ratelimit - ratelimit logging from userspace.
     * on  - unlimited logging from userspace
     * off - logging from userspace gets ignored
    
    The default setting is to ratelimit the messages written to it.
    
    This changes the kernel default setting of "on" to "ratelimit" and we do
    that because we want to keep userspace spamming /dev/kmsg to sane
    levels.  This is especially moot when a small kernel log buffer wraps
    around and messages get lost.  So the ratelimiting setting should be a
    sane setting where kernel messages should have a bit higher chance of
    survival from all the spamming.
    
    It additionally does not limit logging to /dev/kmsg while the system is
    booting if we haven't disabled it on the command line.
    
    Furthermore, we can control the logging from a lower priority sysctl
    interface - kernel.printk_devkmsg.
    
    That interfac...
    750afe7b