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]
Message-ID: <20201116162004.GP1602@alley>
Date:   Mon, 16 Nov 2020 17:20:04 +0100
From:   Petr Mladek <pmladek@...e.com>
To:     Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        John Ogness <john.ogness@...utronix.de>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Guenter Roeck <linux@...ck-us.net>,
        Shreyas Joshi <shreyas.joshi@...mp.com>,
        shreyasjoshi15@...il.com,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] init/console: Use ttynull as a fallback when there
 is no console

On Thu 2020-11-12 10:45:46, Sergey Senozhatsky wrote:
> On (20/11/12 09:17), Sergey Senozhatsky wrote:
> > On (20/11/11 14:54), Petr Mladek wrote:
> > [..]
> > > diff --git a/init/main.c b/init/main.c
> > > index 130376ec10ba..24413c055a85 100644
> > > --- a/init/main.c
> > > +++ b/init/main.c
> > > @@ -1470,8 +1470,14 @@ void __init console_on_rootfs(void)
> > >  	struct file *file = filp_open("/dev/console", O_RDWR, 0);
> > >  
> > >  	if (IS_ERR(file)) {
> > > -		pr_err("Warning: unable to open an initial console.\n");
> > > -		return;
> > > +		pr_err("Warning: unable to open an initial console. Fallback to ttynull.\n");
> > > +		register_ttynull_console();
> > > +
> > 
> > A nit, this probably can be done in console_device() function.
> > 
> > For several reasons:
> > 
> > - we will get covered all the future cases when something other than
> >   console_on_rootfs() will filp_open("/dev/console")

Good point!

My concern is that console_device might be called in "unclear"
context. For example, it is called under tty_mutex in:

	+ tty_open_by_driver()
	  + tty_lookup_driver()
	    + console_device()

Also console_on_rootf() is likely the first code that would actually
use the device.

Well, there is spk_ttyio_initialise_ldisc() that calls tty_kopen().
I am a bit lazy to investigate whether it is called sooner or later.
Anyway, it is accessibility code, so that there should be configured
an accessibility console anyway.

> And the existing ones (including user-space). For instance,
> kernel/bpf/preload/iterators/iterators.c probably fails (?)
> on systems with console=
> 
> 	debug_fd = open("/dev/console", O_WRONLY | O_NOCTTY | O_CLOEXEC);
> 	if (debug_fd < 0)
> 		return 1;
> 
> 	-ss

This looks like an userspace tool, so it should get called after
console_on_rootfs().

It might be my laziness. But I would prefer to go with this patchset.
We could always improve it when anyone meet the problem.

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ