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] [day] [month] [year] [list]
Date:   Wed, 25 Sep 2019 01:49:08 +0200
From:   John Ogness <john.ogness@...utronix.de>
To:     <zhe.he@...driver.com>
Cc:     <linux-rt-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RT] printk: devkmsg: read: Return EPIPE when the first message user-space wants has gone

On 2019-09-24, <zhe.he@...driver.com> wrote:
> From: He Zhe <zhe.he@...driver.com>
>
> When user-space wants to read the first message, that is when user->seq
> is 0, and that message has gone, it currently automatically resets
> user->seq to current first seq. This mis-aligns with mainline kernel.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/ABI/testing/dev-kmsg#n39
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/printk/printk.c#n899
>
> We should inform user-space that what it wants has gone by returning EPIPE
> in such scenario.
>
> Signed-off-by: He Zhe <zhe.he@...driver.com>

Signed-off-by: John Ogness <john.ogness@...utronix.de>

> ---
>  kernel/printk/printk.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
> index e3fa33f2e23c..58c545a528b3 100644
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -703,14 +703,10 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
>  		goto out;
>  	}
>  
> -	if (user->seq == 0) {
> -		user->seq = seq;
> -	} else {
> -		user->seq++;
> -		if (user->seq < seq) {
> -			ret = -EPIPE;
> -			goto restore_out;
> -		}
> +	user->seq++;
> +	if (user->seq < seq) {
> +		ret = -EPIPE;
> +		goto restore_out;
>  	}
>  
>  	msg = (struct printk_log *)&user->msgbuf[0];

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ