lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 17 Apr 2020 16:59:39 +0000
From:   Luis Chamberlain <mcgrof@...nel.org>
To:     Masami Hiramatsu <mhiramat@...nel.org>
Cc:     Vlastimil Babka <vbabka@...e.cz>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Kees Cook <keescook@...omium.org>,
        Iurii Zaikin <yzaikin@...gle.com>,
        linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
        linux-mm@...ck.org, Ivan Teterevkov <ivan.teterevkov@...anix.com>,
        Michal Hocko <mhocko@...nel.org>,
        David Rientjes <rientjes@...gle.com>,
        Matthew Wilcox <willy@...radead.org>,
        "Eric W . Biederman" <ebiederm@...ssion.com>,
        "Guilherme G . Piccoli" <gpiccoli@...onical.com>,
        Alexey Dobriyan <adobriyan@...il.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Christian Brauner <christian.brauner@...ntu.com>
Subject: Re: [PATCH v2 1/3] kernel/sysctl: support setting sysctl parameters
 from kernel command line

On Fri, Apr 17, 2020 at 07:34:42PM +0900, Masami Hiramatsu wrote:
> On Thu, 16 Apr 2020 15:53:27 +0000
> Luis Chamberlain <mcgrof@...nel.org> wrote:
> 
> > On Thu, Apr 16, 2020 at 07:49:55PM +0900, Masami Hiramatsu wrote:
> > > Hi Luis,
> > > 
> > > On Thu, 16 Apr 2020 01:29:31 +0000
> > > Luis Chamberlain <mcgrof@...nel.org> wrote:
> > > 
> > > > On Wed, Apr 15, 2020 at 06:03:55PM +0900, Masami Hiramatsu wrote:
> > > > > On Tue, 14 Apr 2020 13:32:20 +0200
> > > > > Vlastimil Babka <vbabka@...e.cz> wrote:
> > > > > > diff --git a/init/main.c b/init/main.c
> > > > > > index a48617f2e5e5..7b43118215d6 100644
> > > > > > --- a/init/main.c
> > > > > > +++ b/init/main.c
> > > > > > @@ -1372,6 +1372,8 @@ static int __ref kernel_init(void *unused)
> > > > > >  
> > > > > >  	rcu_end_inkernel_boot();
> > > > > >  
> > > > > > +	do_sysctl_args();
> > > > > > +
> > > > > 
> > > > > Ah, I see. Since the sysctl is designed to be called after all __init calls were
> > > > > done, it shouldn't use bootconfig directly because bootconfig is full of __init
> > > > > call.
> > > > 
> > > > The idea is bootconfig would be useful in the sense of a library set of
> > > > helpers which could be modified to remove __init, and then used to
> > > > instrument the cmdline depending on certain debugging kconfig entries.
> > > 
> > > Would you mean making bootconfig (parser and APIs) be more generic so that
> > > other subsystem can reuse it with their data?
> > > Or just make it available after boot? (I think this latter one will be
> > > useful for module initialization)
> > 
> > The later. First use case that comes to mind is debugging cmdline, so
> > to see if what one adds is what ends up happening at run time after
> > boot.
> 
> Hmm, I think that's not so easy to debug command line after boot, because
> the kernel command line is parsed (and handlers are executed) already in
> boot time. We can not repeat it after boot.

Unless you put into the command line everything you need to test on one
boot.

> > > > We currently have no way to purposely extend / break the cmdline for
> > > > debugging purposes, so, bootconfig's parsers, since it already has a
> > > > way to extend the cmdlineline, might make it much easier to do this
> > > > later.
> > > > 
> > > > Without bootconfig, if we wanted to add new kconfig to, for example,
> > > > add new funny cmdline arguments to test they worked or not, we'd have
> > > > to devise our own set of helpers now. ie, new functionality. bootconfig
> > > > however already has existing functionality to tweak the cmdline, and so
> > > > some code could be leveraged there for this purpose.
> > > 
> > > Hmm, you can use the bootconfig as a "supplemental" kernel command line,
> > > but not tweak (like modify/replace) it. Would you like to change the
> > > kernel command line parameter on-line?
> > 
> > It would be during boot. To augment it as if the user had used certain
> > parameters on boot. But if only a new path is tested, and we can't
> > reproduce as if the user had *not* used bootconfig, this idea would
> > only be useful to test bootconfig parsing, nothing else. The hope was
> > to do both.
> 
> As you may know, the bootconfig already supports "additional" kernel
> command line. All keys which starts "kernel" is copied into kernel
> command line at early boot timing. So if you want to write a test
> parameter in the bootconfig, you can do it.

There are two bootparams paths now, the old way, and the new bootconfig
path. Extending test coverage to test bootconfig seems rather easier to
consider. However the hope was that there may be some existing code
within bootconfig which would also allow one to test the old cmdline
path, as if the cmdline had certain params present. It doesn't seem
to be the case.

> However, it is not a good idea to execute command line handlers
> twice because it can be destructive or can append all parameters
> (e.g. "console=" .)

I see so bootconfig is mutually exclusive with the old cmdline?

> For the new feature can natively use the bootconfig, for example
> boot-time tracing (kernel/trace/trace_boot.c) is something like
> this sysctl on boot, and natively uses the bootconfig because
> the tracing parameter is too complex for kernel command line :)

Neat.

  Luis

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ