Re: [PATCH] tcp: possible race between tcp_done() and tcp_poll()

2017-03-29 Thread Seiichi Ikarashi
On 2017-03-30 12:18, Eric Dumazet wrote: > On Thu, 2017-03-30 at 11:55 +0900, Seiichi Ikarashi wrote: > >> I got a report that receiving a RST packet but poll() got only POLLERR, no >> POLLIN|POLLRDHUP . >> It was an old x86_64 kernel which does not include sk_state_{load,store} >> functions. >>

Re: [PATCH] tcp: possible race between tcp_done() and tcp_poll()

2017-03-29 Thread Eric Dumazet
On Thu, 2017-03-30 at 11:55 +0900, Seiichi Ikarashi wrote: > I got a report that receiving a RST packet but poll() got only POLLERR, no > POLLIN|POLLRDHUP . > It was an old x86_64 kernel which does not include sk_state_{load,store} > functions. > I suspected some race might have occur above. It

Re: [PATCH] tcp: possible race between tcp_done() and tcp_poll()

2017-03-29 Thread Seiichi Ikarashi
Hi Eric, On 2017-03-30 11:31, Eric Dumazet wrote: > On Thu, 2017-03-30 at 09:35 +0900, Seiichi Ikarashi wrote: >> Similar to a4d258036ed9 ("tcp: Fix race in tcp_poll"). >> >> Between receiving a packet and tcp_poll(), sk->sk_err is protected by memory >> barriers but >> sk->sk_shutdown and sk->sk

Re: [PATCH] tcp: possible race between tcp_done() and tcp_poll()

2017-03-29 Thread Eric Dumazet
On Thu, 2017-03-30 at 09:35 +0900, Seiichi Ikarashi wrote: > Similar to a4d258036ed9 ("tcp: Fix race in tcp_poll"). > > Between receiving a packet and tcp_poll(), sk->sk_err is protected by memory > barriers but > sk->sk_shutdown and sk->sk_state are not. ... > So possibly, POLLIN|POLLRDNORM|P

[PATCH] tcp: possible race between tcp_done() and tcp_poll()

2017-03-29 Thread Seiichi Ikarashi
Similar to a4d258036ed9 ("tcp: Fix race in tcp_poll"). Between receiving a packet and tcp_poll(), sk->sk_err is protected by memory barriers but sk->sk_shutdown and sk->sk_state are not. So possibly, POLLIN|POLLRDNORM|POLLRDHUP might not be set even when receiving a RST packet. Signed-off-by: S

Re: [PATCH] tcp: possible race between tcp_done() and tcp_poll()

2017-03-29 Thread Seiichi Ikarashi
Thanks Sergei! On 2017-03-29 20:57, Sergei Shtylyov wrote: > Hello! > > On 3/29/2017 8:22 AM, Seiichi Ikarashi wrote: > >> Similar to commit a4d258036ed9b2a1811. > >Commit citing is standardized: it should specify 12-digit (at least) SHA1 > and the commit summary line enclosed in (""). >

Re: [PATCH] tcp: possible race between tcp_done() and tcp_poll()

2017-03-29 Thread Sergei Shtylyov
Hello! On 3/29/2017 8:22 AM, Seiichi Ikarashi wrote: Similar to commit a4d258036ed9b2a1811. Commit citing is standardized: it should specify 12-digit (at least) SHA1 and the commit summary line enclosed in (""). Between receiving a packet and tcp_poll(), sk->sk_err is protected by memo

[PATCH] tcp: possible race between tcp_done() and tcp_poll()

2017-03-28 Thread Seiichi Ikarashi
Similar to commit a4d258036ed9b2a1811. Between receiving a packet and tcp_poll(), sk->sk_err is protected by memory barriers but sk->sk_shutdown and sk->sk_state are not. So possibly, POLLIN|POLLRDNORM|POLLRDHUP might not be set even when receiving a RST packet. Signed-off-by: Seiichi Ikarashi