Re: [PATCH -v4 2/2] printk: Add kernel parameter to control writes to /dev/kmsg

From: Dave Young
Date: Mon Jul 18 2016 - 03:39:11 EST


On 07/18/16 at 09:21am, Borislav Petkov wrote:
> On Mon, Jul 18, 2016 at 01:20:32PM +0800, Dave Young wrote:
> > Sorry, seems I do not get your point, suppose using the bis defined in your
> > patch, shouldn't below work?
>
> When you supply "printk.devkmsg=" on the kernel command line, then
> devkmsg logging setting is final for the current boot because we lock it
> with DEVKMSG_LOG_MASK_LOCK, see control_devkmsg() here:

Boris, I saw that point and I agreed about that design, what I do not like is
the ratelimit part. What in my mind is like below (suppose default=off)

printk.devkmsg= on kernel cmdline
-> locked, one can not use sysctl to change it
-> follow the kernel cmdline setting
no printk.devkmsg= on kernel cmdline
-> unlocked, default is off, writing to /dev/kmsg is forbidded
-> usespace set sysctl printk.devkmsg=on
-> writing to /dev/kmsg is allowed.

Thanks
Dave