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:   Tue, 19 May 2020 10:34:28 -0400
From:   Arvind Sankar <nivedita@...m.mit.edu>
To:     Joe Perches <joe@...ches.com>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        王程刚 <wangchenggang@...o.com>,
        'Masami Hiramatsu' <mhiramat@...nel.org>,
        "'Steven Rostedt (VMware'" <rostedt@...dmis.org>,
        'Kees Cook' <keescook@...omium.org>,
        'Thomas Gleixner' <tglx@...utronix.de>,
        'Dominik Brodowski' <linux@...inikbrodowski.net>,
        'Arvind Sankar' <nivedita@...m.mit.edu>,
        'Mike Rapoport' <rppt@...ux.ibm.com>,
        'Alexander Potapenko' <glider@...gle.com>,
        linux-kernel@...r.kernel.org, kernel@...o.com
Subject: Re: [PATCH] init/main.c: Print all command line when boot

On Mon, May 18, 2020 at 10:09:34PM -0700, Joe Perches wrote:
> On Mon, 2020-05-18 at 20:44 -0700, Andrew Morton wrote:
> > On Tue, 19 May 2020 11:29:46 +0800 王程刚 <wangchenggang@...o.com> wrote:
> > 
> > > Function pr_notice print max length maybe less than the command line length,
> > > need more times to print all.
> > > For example, arm64 has 2048 bytes command line length, but printk maximum
> > > length is only 1024 bytes.
> > 
> > I can see why that might be a problem!
> > 
> > > --- a/init/main.c
> > > +++ b/init/main.c
> > > @@ -825,6 +825,16 @@ void __init __weak arch_call_rest_init(void)
> > >  	rest_init();
> > >  }
> > >  
> > > +static void __init print_cmdline(void)
> > > +{
> > > +	const char *prefix = "Kernel command line: ";
> > 
> > const char prefix[] = "...";
> > 
> > might generate slightly more efficient code.
> > 
> > > +	int len = -strlen(prefix);
> > 
> > hm, tricky.  What the heck does printk() actually return to the caller?
> > Seems that we forgot to document this, and there are so many different
> > paths which a printk call can take internally that I'm not confident
> > that they all got it right!
> 
> There is no use of the return value of any pr_<level> or
> dev_<level> or netdev_<level) in the kernel.
> 
> All the pr_<level> mechanisms (as functions) should return void.
> https://lore.kernel.org/lkml/1466739971-30399-1-git-send-email-joe@perches.com/
> 
> > > +	len += pr_notice("%s%s\n", prefix, boot_command_line);
> > > +	while (boot_command_line[len])
> > > +		len += pr_notice("%s\n", &boot_command_line[len]);
> > > +}
> 
> More likely it'd be better to use a strlen(boot_command_line)
> and perhaps do something like print multiple lines with args
> using strchr(, ' ') at some largish value, say 132 or 256 chars
> maximum per line.
> 
> 
> 

Should it use pr_cont to print the subsequent lines?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ