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: <YC+2HaMczMmuaEM8@alley>
Date:   Fri, 19 Feb 2021 13:59:09 +0100
From:   Petr Mladek <pmladek@...e.com>
To:     John Ogness <john.ogness@...utronix.de>
Cc:     Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH printk-rework 07/14] printk: use atomic64_t for
 devkmsg_user.seq

On Thu 2021-02-18 09:18:10, John Ogness wrote:
> @user->seq is indirectly protected by @logbuf_lock. Once @logbuf_lock
> is removed, @user->seq will be no longer safe from an atomicity point
> of view.
> 
> In preparation for the removal of @logbuf_lock, change it to
> atomic64_t to provide this safety.
> 
> Signed-off-by: John Ogness <john.ogness@...utronix.de>
> ---
>  kernel/printk/printk.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index a71e0d41ccb5..20c21a25143d 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -865,9 +865,9 @@ static __poll_t devkmsg_poll(struct file *file, poll_table *wait)
>  	poll_wait(file, &log_wait, wait);
>  
>  	logbuf_lock_irq();
> -	if (prb_read_valid_info(prb, user->seq, &info, NULL)) {
> +	if (prb_read_valid(prb, atomic64_read(&user->seq), NULL)) {

s/prb_read_valid/prb_read_valid_info/

It is likely a mistake when rebasing on top of the commit
13791c80b0cdf54d ("printk: avoid prb_first_valid_seq() where possible").

>  		/* return error when data has vanished underneath us */
> -		if (info.seq != user->seq)
> +		if (info.seq != atomic64_read(&user->seq))
>  			ret = EPOLLIN|EPOLLRDNORM|EPOLLERR|EPOLLPRI;
>  		else
>  			ret = EPOLLIN|EPOLLRDNORM;

With the above fix:

Reviewed-by: Petr Mladek <pmladek@...e.com>

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ