From: Cong Wang <hidden> Date: 2021-07-23 18:36:41
From: Cong Wang <redacted>
As Eric noticed, __unix_dgram_recvmsg() may acquire u->iolock
too, so we have to release it before calling this function.
Fixes: 9825d866ce0d ("af_unix: Implement unix_dgram_bpf_recvmsg()")
Reported-by: Eric Dumazet <redacted>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jakub Sitnicki <jakub@cloudflare.com>
Cc: Lorenz Bauer <redacted>
Signed-off-by: Cong Wang <redacted>
---
net/unix/unix_bpf.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
From: John Fastabend <john.fastabend@gmail.com> Date: 2021-07-27 16:12:27
Cong Wang wrote:
quoted hunk
From: Cong Wang <redacted>
As Eric noticed, __unix_dgram_recvmsg() may acquire u->iolock
too, so we have to release it before calling this function.
Fixes: 9825d866ce0d ("af_unix: Implement unix_dgram_bpf_recvmsg()")
Reported-by: Eric Dumazet <redacted>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jakub Sitnicki <jakub@cloudflare.com>
Cc: Lorenz Bauer <redacted>
Signed-off-by: Cong Wang <redacted>
---
net/unix/unix_bpf.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
Is there a reason to grab the mutex_lock(u->iolock) above the
skb_queue_emptyaand sk_psock_queue_empty checks?
Could it be move here just above the msg_bytes_ready label?
quoted hunk
msg_bytes_ready:
@@ -68,13 +69,13 @@ static int unix_dgram_bpf_recvmsg(struct sock *sk, struct msghdr *msg, if (data) { if (!sk_psock_queue_empty(psock)) goto msg_bytes_ready;- ret = __unix_dgram_recvmsg(sk, msg, len, flags);- goto out;+ mutex_unlock(&u->iolock);+ sk_psock_put(sk, psock);+ return __unix_dgram_recvmsg(sk, msg, len, flags); } copied = -EAGAIN; } ret = copied;-out: mutex_unlock(&u->iolock); sk_psock_put(sk, psock); return ret;
From: Cong Wang <hidden> Date: 2021-07-28 03:07:00
On Tue, Jul 27, 2021 at 9:12 AM John Fastabend [off-list ref] wrote:
Is there a reason to grab the mutex_lock(u->iolock) above the
skb_queue_emptyaand sk_psock_queue_empty checks?
Could it be move here just above the msg_bytes_ready label?
The check of the receive queue is more accurate with lock.
Thanks.
From: Jakub Sitnicki <jakub@cloudflare.com> Date: 2021-07-28 10:12:19
On Fri, Jul 23, 2021 at 08:36 PM CEST, Cong Wang wrote:
quoted hunk
From: Cong Wang <redacted>
As Eric noticed, __unix_dgram_recvmsg() may acquire u->iolock
too, so we have to release it before calling this function.
Fixes: 9825d866ce0d ("af_unix: Implement unix_dgram_bpf_recvmsg()")
Reported-by: Eric Dumazet <redacted>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jakub Sitnicki <jakub@cloudflare.com>
Cc: Lorenz Bauer <redacted>
Signed-off-by: Cong Wang <redacted>
---
net/unix/unix_bpf.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
From: John Fastabend <john.fastabend@gmail.com> Date: 2021-07-28 18:52:55
Jakub Sitnicki wrote:
On Fri, Jul 23, 2021 at 08:36 PM CEST, Cong Wang wrote:
quoted
From: Cong Wang <redacted>
As Eric noticed, __unix_dgram_recvmsg() may acquire u->iolock
too, so we have to release it before calling this function.
Fixes: 9825d866ce0d ("af_unix: Implement unix_dgram_bpf_recvmsg()")
Reported-by: Eric Dumazet <redacted>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jakub Sitnicki <jakub@cloudflare.com>
Cc: Lorenz Bauer <redacted>
Signed-off-by: Cong Wang <redacted>
---
net/unix/unix_bpf.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
On Wed, Jul 28, 2021 at 11:53 AM John Fastabend
[off-list ref] wrote:
Jakub Sitnicki wrote:
quoted
On Fri, Jul 23, 2021 at 08:36 PM CEST, Cong Wang wrote:
quoted
From: Cong Wang <redacted>
As Eric noticed, __unix_dgram_recvmsg() may acquire u->iolock
too, so we have to release it before calling this function.
Fixes: 9825d866ce0d ("af_unix: Implement unix_dgram_bpf_recvmsg()")
Reported-by: Eric Dumazet <redacted>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jakub Sitnicki <jakub@cloudflare.com>
Cc: Lorenz Bauer <redacted>
Signed-off-by: Cong Wang <redacted>
---
net/unix/unix_bpf.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)