[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5e288c28c0289_1de22aea94eb45c0bb@john-XPS-13-9370.notmuch>
Date: Wed, 22 Jan 2020 09:53:44 -0800
From: John Fastabend <john.fastabend@...il.com>
To: Jakub Sitnicki <jakub@...udflare.com>, netdev@...r.kernel.org
Cc: John Fastabend <john.fastabend@...il.com>,
syzbot+d73682fcf7fee6982fe3@...kaller.appspotmail.com
Subject: RE: [PATCH net] net, sk_msg: Don't check if sock is locked when
tearing down psock
Jakub Sitnicki wrote:
> As John Fastabend reports [0], psock state tear-down can happen on receive
> path *after* unlocking the socket, if the only other psock user, that is
> sockmap or sockhash, releases its psock reference before tcp_bpf_recvmsg
> does so:
>
> tcp_bpf_recvmsg()
> psock = sk_psock_get(sk) <- refcnt 2
> lock_sock(sk);
> ...
> sock_map_free() <- refcnt 1
> release_sock(sk)
> sk_psock_put() <- refcnt 0
>
> Remove the lockdep check for socket lock in psock tear-down that got
> introduced in 7e81a3530206 ("bpf: Sockmap, ensure sock lock held during
> tear down").
>
> [0] https://lore.kernel.org/netdev/5e25dc995d7d_74082aaee6e465b441@john-XPS-13-9370.notmuch/
>
> Fixes: 7e81a3530206 ("bpf: Sockmap, ensure sock lock held during tear down")
> Reported-by: syzbot+d73682fcf7fee6982fe3@...kaller.appspotmail.com
> Suggested-by: John Fastabend <john.fastabend@...il.com>
> Signed-off-by: Jakub Sitnicki <jakub@...udflare.com>
> ---
> net/core/skmsg.c | 2 --
> 1 file changed, 2 deletions(-)
Thanks Jakub, this was not needed I got a bit carried away. I'll add
a selftest to catch this case by duplicating the reproducer into
test_sockmap.c
Acked-by: John Fastabend <john.fastabend@...il.com>
Powered by blists - more mailing lists