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: <877d7gu7yg.fsf@jogness.linutronix.de>
Date:   Fri, 22 Apr 2022 23:31:11 +0206
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,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH printk v3 14/15] printk: extend console_lock for proper
 kthread support

On 2022-04-22, Petr Mladek <pmladek@...e.com> wrote:
> Another problem is that the ordering is not stable. The console
> might come and go.

The console list is protected by @console_sem, so it wouldn't be an
actual problem. The real issue is that lockdep would not like it. A new
lockdep class would need to be setup for each register_console().

>> Anyway, I will first look into the nested locking solution. That
>> seems more promising to me and it would go a long way to simplify the
>> locking hierarchy.
>
> Please, do not spend too much time on this. The solution must be
> simple in principle. If it gets complicated than it will likely
> be worse than the current code.

Sure. The goal is to simplify. The only complexity will be doing in a
way that allow lockdep to understand it.

> Alternative solution would be to reduce the number of variables
> affected by the race. I mean:
>
>    + replace CON_THB_BLOCKED flag with con->blocked to avoid
>      the needed of READ_ONCE()/WRITE_ONCE().
>
>    + check con->blocked right after taking con->lock in
>      printk_kthread_func() so that all the other accesses are
>      safe.

Honestly, I would prefer this to what v4 is doing. The only reason
CON_THD_BLOCKED is a flag is to save space. But we are only talking
about a few bytes being saved. There aren't that many consoles.

It would be a very simple change. Literally just replacing the 3 lines
that set/clear CON_THD_BLOCKED and replacing/reordering the 2 lines that
check the flag. Then all the READ_ONCE/WRITE_ONCE to @flags could be
removed.

John

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ