diff options
author | Kuniyuki Iwashima <kuniyu@amazon.com> | 2025-01-16 06:34:38 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2025-01-20 20:27:41 +0100 |
commit | 533643b091dd6e246d57caf81e6892fa9cbb1cc9 (patch) | |
tree | d64593a670463e8a16e333ee27d3bb20a83f8db6 /net/unix/af_unix.c | |
parent | af_unix: Set drop reason in __unix_gc(). (diff) | |
download | linux-533643b091dd6e246d57caf81e6892fa9cbb1cc9.tar.xz linux-533643b091dd6e246d57caf81e6892fa9cbb1cc9.zip |
af_unix: Set drop reason in manage_oob().
AF_UNIX SOCK_STREAM socket supports MSG_OOB.
When OOB data is sent to a socket, recv() will break at that point.
If the next recv() does not have MSG_OOB, the normal data following
the OOB data is returned.
Then, the OOB skb is dropped.
Let's define a new drop reason for that case in manage_oob().
# echo 1 > /sys/kernel/tracing/events/skb/kfree_skb/enable
# python3
>>> from socket import *
>>> s1, s2 = socketpair(AF_UNIX)
>>> s1.send(b'a', MSG_OOB)
>>> s1.send(b'b')
>>> s2.recv(2)
b'b'
# cat /sys/kernel/tracing/trace_pipe
...
python3-223 ... kfree_skb: ... location=unix_stream_read_generic+0x59e/0xc20 reason: UNIX_SKIP_OOB
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://patch.msgid.link/20250116053441.5758-6-kuniyu@amazon.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | net/unix/af_unix.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 41b99984008a..e31fda1d319f 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -2695,7 +2695,7 @@ unlock: spin_unlock(&sk->sk_receive_queue.lock); consume_skb(read_skb); - kfree_skb(unread_skb); + kfree_skb_reason(unread_skb, SKB_DROP_REASON_UNIX_SKIP_OOB); return skb; } |