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:   Wed, 26 Jan 2022 14:49:10 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     TATSUKAWA KOSUKE(立川 江介) 
        <tatsu-ab1@....com>
Cc:     Jiri Slaby <jirislaby@...nel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] n_tty: wake up poll(POLLRDNORM) on receiving data

On Mon, Jan 24, 2022 at 08:17:22AM +0000, TATSUKAWA KOSUKE(立川 江介) wrote:
> Event POLLRDNORM should be equivalent to POLLIN when used as event in
> poll().

Where is that documented?

> However, in n_tty driver, POLLRDNORM does not return until
> timeout even if there is terminal input, whereas POLLIN returns.
> 
> The following test program works until kernel-3.17, but the test stops
> in poll() after commit 57087d515441 ("tty: Fix spurious poll() wakeups").
> 
> [Steps to run test program]
>   $ cc -o test-pollrdnorm test-pollrdnorm.c
>   $ ./test-pollrdnorm
>   foo          <-- Type in something from the terminal followed by [RET].
>                    The string should be echoed back.
> 
>   ------------------------< test-pollrdnorm.c >------------------------
>   #include <stdio.h>
>   #include <errno.h>
>   #include <poll.h>
>   #include <unistd.h>
> 
>   void main(void)
>   {
> 	int		n;
> 	unsigned char	buf[8];
> 	struct pollfd	fds[1] = {{ 0, POLLRDNORM, 0 }};
> 
> 	n = poll(fds, 1, -1);
> 	if (n < 0)
> 		perror("poll");
> 	n = read(0, buf, 8);
> 	if (n < 0)
> 		perror("read");
> 	if (n > 0)
> 		write(1, buf, n);
>   }
>   ------------------------------------------------------------------------
> 
> The attached patch fixes this problem.
> 
> Signed-off-by: Kosuke Tatsukawa <tatsu-ab1@....com>
> Fixes: commit 57087d515441 ("tty: Fix spurious poll() wakeups")

No need for "commit" here, please remove as the documentation asks you
to.

Can you resend this with this fixed up, and a pointer to where the
documentation is for this functionality.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ