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: <875yfgo3k1.fsf@jogness.linutronix.de>
Date:   Tue, 15 Nov 2022 12:39:18 +0106
From:   John Ogness <john.ogness@...utronix.de>
To:     Petr Mladek <pmladek@...e.com>
Cc:     Sergey Senozhatsky <senozhatsky@...omium.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org, Miguel Ojeda <ojeda@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "Paul E . McKenney" <paulmck@...nel.org>
Subject: Re: [PATCH printk v4 03/39] printk: Prepare for SRCU console list
 protection

On 2022-11-15, Petr Mladek <pmladek@...e.com> wrote:
> On Mon 2022-11-14 17:34:56, John Ogness wrote:
>> Provide an NMI-safe SRCU protected variant to walk the console list.
>> 
>> Note that all console fields are now set before adding the console
>> to the list to avoid the console becoming visible by SCRU readers
>> before being fully initialized.
>> 
>> This is a preparatory change for a new console infrastructure which
>> operates independent of the console BKL.
>> 
>> --- a/kernel/printk/printk.c
>> +++ b/kernel/printk/printk.c
>> @@ -3254,7 +3303,7 @@ int unregister_console(struct console *console)
>>  		return -ENODEV;
>>  	}
>>  
>> -	hlist_del_init(&console->node);
>> +	hlist_del_init_rcu(&console->node);
>
> This should be hlist_del_rcu() here so that a list walker that it just
> processing this console could see the rest of the list.

hlist_del_init_rcu() does not prevent the rest of the list from being
seen. It only unlinks @pprev for future iterators.

> It seems that hlist_unhashed() checks only node.pprev pointer
> so that we even do not need to initialize it.
>
> We discussed this in v3 in the patch implementing
> console_force_preferred_locked(), see
> https://lore.kernel.org/r/Y20aBwNWT19YDeib@alley.
> I forgot that unregister_console() might have the same problem.

For console_force_preferred_locked() it was about making sure that the
console always appears registered, even though it is temporarily removed
from the console list.

For unregister_console() we want it to be seen as removed from the
console list.

John

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ