Re: [PATCH v2] printk: Add kernel parameter to disable writes to /dev/kmsg

From: Steven Rostedt
Date: Mon Apr 25 2016 - 15:30:44 EST


On Mon, 25 Apr 2016 12:18:15 -0700
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:

> On Mon, Apr 25, 2016 at 09:06:51PM +0200, Peter Zijlstra wrote:
> > On Mon, Apr 25, 2016 at 02:56:06PM -0400, Steven Rostedt wrote:
> > > +static bool __read_mostly devkmsg_disabled;
> > > +static int __init disable_devkmsg(char *str)
> > > +{
> > > + devkmsg_disabled = true;
> > > + return 0;
> > > +}
> > > +__setup("printk.disable_kmsg_write", disable_devkmsg);
> >
> > Again, please default enable and use an easier name to toggle this.
> > Userspace flooding this with junk is really insane.

Peter,

I would love to default enable it, but as Greg said...

>
> If you default enable, you break working systems today that want to log
> stuff through this interface, sorry.

I'm not trying to be confrontational here, as these conversations
usually become. I just want a way to keep my systems from having user
space blowing away logs I care about. This is my way to compromise,
letting distros continue to do things the way they always do, and a way
for us to not be disrupted by it.

I could also add a config that default enables it. Then you just need
to make sure that config is set when you build your kernels. That
doesn't help me as I also want this in kernels that I don't build.

Peter, yes it's a rather long nasty name to remember, but it's
documented in kernel-parameters.txt and once you add it as your default
command line, you should be able to quickly forget about it. That's my
plan.

There's too many parameters already that namespace pollution pretty
much dictates this. :-/

-- Steve