From: Rao Shoaib <redacted>
syzkaller found that OOB code was holding spinlock
while calling a function in which it could sleep.
Reported-by: syzbot+8760ca6c1ee783ac4abd@syzkaller.appspotmail.com
Fixes: 314001f0bf92 ("af_unix: Add OOB support")
Signed-off-by: Rao Shoaib <redacted>
---
net/unix/af_unix.c | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
From: Eric Dumazet <edumazet@google.com> Date: 2021-08-12 07:53:49
On Thu, Aug 12, 2021 at 12:07 AM Rao Shoaib [off-list ref] wrote:
From: Rao Shoaib <redacted>
syzkaller found that OOB code was holding spinlock
while calling a function in which it could sleep.
Reported-by: syzbot+8760ca6c1ee783ac4abd@syzkaller.appspotmail.com
Fixes: 314001f0bf92 ("af_unix: Add OOB support")
Signed-off-by: Rao Shoaib <redacted>
---
Please do not add these empty lines.
Fixes: ...
Reported-by: ...
Signed-off-by: ...
Also you might take a look at queue_oob()
1) Setting skb->len tp 1 should not be needed, skb_put() already does that
2) After unix_state_lock(other); we probably need to check status of
the other socket.
3) Some skb_free() calls should have been consume_skb()
Hi Eric,
Thanks for your review I will take care of the comments.
Shoaib
On 8/12/21 12:53 AM, Eric Dumazet wrote:
quoted hunk
On Thu, Aug 12, 2021 at 12:07 AM Rao Shoaib [off-list ref] wrote:
quoted
From: Rao Shoaib <redacted>
syzkaller found that OOB code was holding spinlock
while calling a function in which it could sleep.
Reported-by: syzbot+8760ca6c1ee783ac4abd@syzkaller.appspotmail.com
Fixes: 314001f0bf92 ("af_unix: Add OOB support")
Signed-off-by: Rao Shoaib <redacted>
---
Please do not add these empty lines.
Fixes: ...
Reported-by: ...
Signed-off-by: ...
Also you might take a look at queue_oob()
1) Setting skb->len tp 1 should not be needed, skb_put() already does that
2) After unix_state_lock(other); we probably need to check status of
the other socket.
3) Some skb_free() calls should have been consume_skb()
From: Eric Dumazet <edumazet@google.com> Date: 2021-08-12 20:33:45
On Thu, Aug 12, 2021 at 7:37 PM Shoaib Rao [off-list ref] wrote:
On 8/12/21 12:53 AM, Eric Dumazet wrote:
quoted
if (ousk->oob_skb)
- kfree_skb(ousk->oob_skb);
+ consume_skb(ousk->oob_skb);
Should I be using consume_skb(), as the skb is not being consumed, the
ref count is decremented and if zero skb will be freed.
consume_skb() and kfree_skb() have the same ref count handling.
The difference is that kfree_skb() is used by convention when a packet
is dropped
Admins can look closely at packet drops with drop_monitor, or :
perf record -a -g -e skb:kfree_skb sleep 10
perf report
In your case, the oob_skb is not really dropped. It is replaced by
another one, it is part of the normal operation.
On Thu, Aug 12, 2021 at 7:37 PM Shoaib Rao [off-list ref] wrote:
quoted
On 8/12/21 12:53 AM, Eric Dumazet wrote:
quoted
if (ousk->oob_skb)
- kfree_skb(ousk->oob_skb);
+ consume_skb(ousk->oob_skb);
Should I be using consume_skb(), as the skb is not being consumed, the
ref count is decremented and if zero skb will be freed.
consume_skb() and kfree_skb() have the same ref count handling.
The difference is that kfree_skb() is used by convention when a packet
is dropped
Admins can look closely at packet drops with drop_monitor, or :
perf record -a -g -e skb:kfree_skb sleep 10
perf report
In your case, the oob_skb is not really dropped. It is replaced by
another one, it is part of the normal operation.
Thanks a lot for the explanation. This was very helpful. In my case the
skb may be dropped (oob was not read but the read has passed beyond oob,
or could become part of normal data). Anyways, I will change it to use
consume_skb().
Regards,
Shoaib
From: Jakub Kicinski <kuba@kernel.org> Date: 2021-08-13 17:32:52
On Wed, 11 Aug 2021 15:06:52 -0700 Rao Shoaib wrote:
From: Rao Shoaib <redacted>
syzkaller found that OOB code was holding spinlock
while calling a function in which it could sleep.
Reported-by: syzbot+8760ca6c1ee783ac4abd@syzkaller.appspotmail.com
Fixes: 314001f0bf92 ("af_unix: Add OOB support")
Signed-off-by: Rao Shoaib <redacted>
IIUC issues pointed out by Eric are separate so I removed the spacing
between the tags and applied, thanks!
OH, I just sent you a combined patch. I will resend it with just the
nits pointed out by Eric.
Shoaib
On 8/13/21 10:32 AM, Jakub Kicinski wrote:
On Wed, 11 Aug 2021 15:06:52 -0700 Rao Shoaib wrote:
quoted
From: Rao Shoaib <redacted>
syzkaller found that OOB code was holding spinlock
while calling a function in which it could sleep.
Reported-by: syzbot+8760ca6c1ee783ac4abd@syzkaller.appspotmail.com
Fixes: 314001f0bf92 ("af_unix: Add OOB support")
Signed-off-by: Rao Shoaib <redacted>
IIUC issues pointed out by Eric are separate so I removed the spacing
between the tags and applied, thanks!