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: <20190425075002.r4g325fyh5jmabzs@pathway.suse.cz>
Date:   Thu, 25 Apr 2019 09:50:02 +0200
From:   Petr Mladek <pmladek@...e.com>
To:     Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc:     Steven Rostedt <rostedt@...dmis.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linux-kernel@...r.kernel.org,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>
Subject: Re: [RFC][PATCH 1/2] printk: lock console_sem before we unregister
 boot consoles

On Thu 2019-04-25 12:52:33, Sergey Senozhatsky wrote:
> On (04/24/19 16:49), Petr Mladek wrote:
> > > +	if (bcon && (newcon->flags & (CON_CONSDEV|CON_BOOT)) == CON_CONSDEV) {
> > > +		console_lock();
> > > +		/*
> > > +		 * We need to iterate through all boot consoles, to make
> > >  		 * sure we print everything out, before we unregister them.
> > >  		 */
> > 
> > I wondered if moving the console locking could break the above
> > statement.
> > 
> > It seems that the comment has been invalid since the commit
> > 8259cf4342029aad37660e ("printk: Ensure that "console
> > enabled" messages are printed on the console").
> 
> That's very interesting. Yes, you are right, the comment is a
> leftover. printk used to iterate consoles twice before
> 8259cf4342029aad37660e
> 
>                /* we need to iterate through twice, to make sure we print
>                 * everything out, before we unregister the console(s)
>                 */
>                printk(KERN_INFO "console handover:");
>                for_each_console(bcon)
>                        printk("boot [%s%d] ", bcon->name, bcon->index);
> 
>                printk(" -> real [%s%d]\n", newcon->name, newcon->index);
>                for_each_console(bcon)
>                        unregister_console(bcon);
> 
> But 8259cf4342029aad37660e has changed that and has made comment
> invalid.
> 
> > Could we remove it in this patch? It touches it indirectly anyway.
> 
> Sure we can.
> 
> We also can take extra care of pr_info("%sconsole [%s%d] enabled\n".
> Right now we do
> 
> 	...
> 	console_unlock();
> 	console_sysfs_notify();
> 
> 	pr_info("%sconsole [%s%d] enabled\n",....
> 
> 
> But we can simply move that pr_info() a bit up:
> 
> 	pr_info("%sconsole [%s%d] enabled\n",
> 	console_unlock();
> 	console_sysfs_notify();
> 
> 
> So the message will be printed on all consoles.

Great idea!

It would deserve a separate patch that moves the pr_info()
and removes the invalid comment.

Actually, the pr_info() would deserve a comment explaining
why it should be called before console_unlock().

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ