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: <Y1f1RpMVAo2vHxce@alley>
Date:   Tue, 25 Oct 2022 16:40:06 +0200
From:   Petr Mladek <pmladek@...e.com>
To:     John Ogness <john.ogness@...utronix.de>
Cc:     Sergey Senozhatsky <senozhatsky@...omium.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH printk v2 25/38] proc: consoles: document console_lock
 usage

On Wed 2022-10-19 17:01:47, John Ogness wrote:
> The console_lock is held throughout the start/show/stop procedure
> to print out device/driver information about all registered
> consoles. Since the console_lock is being used for multiple reasons,
> explicitly document these reasons. This will be useful when the
> console_lock is split into fine-grained locking.
> 
> Signed-off-by: John Ogness <john.ogness@...utronix.de>
> ---
>  fs/proc/consoles.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/fs/proc/consoles.c b/fs/proc/consoles.c
> index cf2e0788f9c7..32512b477605 100644
> --- a/fs/proc/consoles.c
> +++ b/fs/proc/consoles.c
> @@ -63,6 +63,14 @@ static void *c_start(struct seq_file *m, loff_t *pos)
>  	struct console *con;
>  	loff_t off = 0;
>  
> +	/*
> +	 * Stop console printing because the device() callback may
> +	 * assume the console is not within its write() callback.

Like in previous patches, I would prefer to add more information
about this dependency. An example or if it is just to stay
on the safe side.

> +	 *
> +	 * Hold the console_lock to guarantee safe traversal of the
> +	 * console list. SRCU cannot be used because there is no
> +	 * place to store the SRCU cookie.

It might be possible to crate a custom struct for passing both
the next struct console and SRCU cookie. But it probably
is not worth it.

> +	 */
>  	console_lock();
>  	for_each_console(con)
>  		if (off++ == *pos)

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ