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  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:   Thu, 21 May 2020 21:48:56 +0900
From:   Sergey Senozhatsky <sergey.senozhatsky@...il.com>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Joe Perches <joe@...ches.com>,
        Chenggang Wang <wangchenggang@...o.com>,
        linux-kernel@...r.kernel.org, Petr Mladek <pmladek@...e.com>,
        Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [RFC PATCH 2/2] init: Allow multi-line output of kernel command
 line

On (20/05/20 21:40), Andrew Morton wrote:
> > On (20/05/20 18:00), Andrew Morton wrote:
> > [..]
> > > I'm wondering if we shold add a kernel puts() (putsk()?  yuk) which can
> > > puts() a string of any length.
> > > 
> > > I'm counting around 150 instances of printk("%s", ...) and pr_foo("%s",
> > > ...) which could perhaps be converted, thus saving an argument.
> > 
> > Can you point me at some examples?
> > 
> 
> ./arch/powerpc/kernel/udbg.c:           printk("%s", s);
> ./arch/powerpc/xmon/nonstdio.c:         printk("%s", xmon_outbuf);
> ./arch/um/os-Linux/drivers/ethertap_user.c:             printk("%s", output);
> ./arch/um/os-Linux/drivers/ethertap_user.c:             printk("%s", output);
> ./arch/um/os-Linux/drivers/tuntap_user.c:                       printk("%s", out

Hmm, interesting.

	output = uml_kmalloc(UM_KERN_PAGE_SIZE, UM_GFP_KERNEL);
	read_output(fd, output, UM_KERN_PAGE_SIZE);
	printk("%s", output);
	kfree(output);

> etc.
>
> My point is, if we created a length-unlimited puts() function for printing the
> kernel command line, it could be reused in such places

A function that prints the kernel command line is a bit different
in the way that we can split command line arguments - they are
space separated, which is very convenient - so we would pr_cont()
parts of command line individually. This has an advantage that we
won't \r\n in the middle of the parameter.

Looking at examples, it seems that most of them simply do a single
printk() with arbitrary sized buffers that contain random data,
not necessarily space separated. So same problem - we truncate
messages (maybe?), but needs a slightly different solution (?).

	-ss

Powered by blists - more mailing lists