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]
Date:   Fri, 25 Jun 2021 09:33:54 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     John Ogness <john.ogness@...utronix.de>
Cc:     Petr Mladek <pmladek@...e.com>,
        Sergey Senozhatsky <senozhatsky@...omium.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH printk v3 6/6] printk: syslog: close window between wait
 and read

On Thu, 24 Jun 2021 13:17:48 +0206
John Ogness <john.ogness@...utronix.de> wrote:

> +	 * @syslog_lock is held when entering the read loop to prevent
> +	 * another reader from modifying @syslog_seq.

You should add to the above comment:

	 * And the @syslog_lock is released before exiting the loop.

Because it's not normal to enter a loop locked, and have it unlocked
when exiting the loop. And I can envision in the future, someone might
add a break (for error) while still holding the lock.

-- Steve

> +	 */
> +
> +	for (;;) {
>  		size_t n;
>  		size_t skip;
>  
> -		mutex_lock(&syslog_lock);
>  		if (!prb_read_valid(prb, syslog_seq, &r)) {
>  			mutex_unlock(&syslog_lock);
>  			break;
> @@ -1542,8 +1570,13 @@ static int syslog_print(char __user *buf, int size)
>  		len += n;
>  		size -= n;
>  		buf += n;
> -	}
>  
> +		if (!size)
> +			break;
> +
> +		mutex_lock(&syslog_lock);
> +	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ