af_unix: Drop MSG_OOB support.
Subsystems (8)
Kuniyuki Iwashima
maintainercover af_unix: Drop MSG_OOB support.
MSG_OOB implementation is quite buggy and has received many CVEs, which led to CONFIG_AF_UNIX_OOB, but the default is 'y' so it is enabled by major distros, even though there is no clear use case.
In addition, such bugs have changed user-visible MSG_OOB behaviour many times, but no one complained about that.
MSG_OOB is often used to upgrade a trivial bug to LPE.
We do not have good reason to maintain such an unused feature and expose many users to risk.
This series drops MSG_OOB support.
Kuniyuki Iwashima (4):
selftests: landlock: Replace MSG_OOB with O_ASYNC+F_SETSIG.
selftests: bpf: sockmap: Remove AF_UNIX MSG_OOB test case.
selftests: af_unix: Remove MSG_OOB tests.
af_unix: Remove MSG_OOB.
include/net/af_unix.h | 3 - include/net/dropreason-core.h | 6 - net/unix/Kconfig | 7 - net/unix/af_unix.c | 252 +---- .../selftests/bpf/prog_tests/sockmap_redir.c | 45 +- tools/testing/selftests/landlock/config | 1 - .../selftests/landlock/scoped_signal_test.c | 55 +- .../testing/selftests/net/af_unix/.gitignore | 1 - tools/testing/selftests/net/af_unix/Makefile | 1 - tools/testing/selftests/net/af_unix/config | 1 - tools/testing/selftests/net/af_unix/msg_oob.c | 958 ------------------ .../selftests/net/af_unix/scm_rights.c | 45 +- 12 files changed, 35 insertions(+), 1340 deletions(-) delete mode 100644 tools/testing/selftests/net/af_unix/msg_oob.c
Signature · 1 line
2.56.0.611.g1030f0b940-goog
Kuniyuki Iwashima
maintainerPATCH 1/4 selftests: landlock: Replace MSG_OOB with O_ASYNC+F_SETSIG.
AF_UNIX will drop MSG_OOB support.
scoped_signal_test.c uses MSG_OOB in fown.sigurg_socket and trace_fown.deny_scope_fown to trigger SIGURG and exercise security_file_send_sigiotask().
The same hook can be exercised via send_sigio() with a plain send() by setting O_ASYNC and F_SETSIG with SIGURG on recv_socket.
Let's replace MSG_OOB with O_ASYNC and F_SETSIG so that the tests do not depend on CONFIG_AF_UNIX_OOB.
Note that with O_ASYNC set on recv_socket, closing client_socket while recv_socket is still open also triggers SIGURG for POLL_HUP in unix_release_sock(), which would emit an extra landlock_deny_scope_signal trace event in trace_fown.deny_scope_fown. Thus, the child waits for the parent to close recv_socket via pipe_parent before closing client_socket.
---
Cc: "Mickaël Salaün" <[email protected]>
Cc: "Günther Noack" <[email protected]>
Cc: [email protected]
--- tools/testing/selftests/landlock/config | 1 - .../selftests/landlock/scoped_signal_test.c | 55 ++++++++----------- 2 files changed, 22 insertions(+), 34 deletions(-)
tools/testing/selftests/landlock/config +0 -1
@@ -1,4 +1,3 @@ -CONFIG_AF_UNIX_OOB=y CONFIG_AUDIT=y CONFIG_CGROUPS=y CONFIG_CGROUP_SCHED=y
tools/testing/selftests/landlock/scoped_signal_test.c +22 -33
127 lines not on this page · raw message
Signature · 1 line
2.56.0.611.g1030f0b940-goog
[email protected]
AI reviewRe: [PATCH v1 net-next 1/4] selftests: landlock: Replace MSG_OOB with O_ASYNC+F_SETSIG.
Sashiko has reviewed this patch and found no issues.
Quoted 12 lines
AF_UNIXwill dropMSG_OOBsupport.
scoped_signal_test.cusesMSG_OOBin fown.sigurg_socket and trace_fown.deny_scope_fown to trigger SIGURG and exercisesecurity_file_send_sigiotask().The same hook can be exercised via
send_sigio()with a plainsend()by settingO_ASYNCandF_SETSIGwith SIGURG onrecv_socket.Let's replace
MSG_OOBwithO_ASYNCandF_SETSIGso that the tests do not depend onCONFIG_AF_UNIX_OOB.
Quoted 8 lines
Note that with
O_ASYNCset onrecv_socket, closingclient_socketwhilerecv_socketis still open also triggers SIGURG forPOLL_HUPinunix_release_sock(), which would emit an extralandlock_deny_scope_signaltrace event in trace_fown.deny_scope_fown. Thus, the child waits for the parent to closerecv_socketviapipe_parentbefore closingclient_socket.Signed-off-by Kuniyuki Iwashima <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
[email protected]
AI reviewRe: [PATCH v1 net-next 1/4] selftests: landlock: Replace MSG_OOB with O_ASYNC+F_SETSIG.
In reply to Kuniyuki IwashimaThank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you…
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] After this patch, no landlock selftest reaches hook_file_send_sigiotask() through send_sigurg().
--
selftests: landlock: Replace MSG_OOB with O_ASYNC+F_SETSIG.
This commit removes MSG_OOB from the fown.sigurg_socket and trace_fown.deny_scope_fown tests. They now do a plain send() to a socket with O_ASYNC and F_SETSIG(SIGURG) set, so they no longer depend on CONFIG_AF_UNIX_OOB. The commit also drops CONFIG_AF_UNIX_OOB from the landlock selftest config, and it moves the close() of client_socket later so that no extra POLL_HUP signal is sent.
Quoted 4 lines
tools/testing/selftests/landlock/scoped_signal_test.c +0
-0
[ ... ]
tools/testing/selftests/landlock/scoped_signal_test.c TEST_F(fown, sigurg_socket) · line 547
Quoted 11 lines
tools/testing/selftests/landlock/scoped_signal_test.c +3
-1@@ -560,20 +539,22 @@ TEST_F(fown, sigurg_socket)create_scoped_domain (_metadata,LANDLOCK_SCOPE_SIGNAL );/* -* Sets the child to receive SIGURG for MSG_OOB. This uncommon use is +* Sets the child to receive SIGURG. This uncommon use is * a valid attack scenario which also simplifies this test. */ ASSERT_EQ (0 ,fcntl (recv_socket,F_SETOWN , child)); +ASSERT_EQ (0 ,fcntl (recv_socket,F_SETSIG ,SIGURG )); +ASSERT_EQ (0 ,fcntl (recv_socket,F_SETFL ,O_ASYNC ));
[Severity: Low]
After this change, does any landlock selftest still reach hook_file_send_sigiotask() through send_sigurg()?
fown.sigurg_socket and trace_fown.deny_scope_fown now reach the hook only through the send_sigio() path:
sock_wake_async()
kill_fasync()
send_sigio()
send_sigio_to_task()
sigio_perm()
The sigio_to_pgid_members and sigio_to_pgid_self tests in the same file already cover that path. They use a pipe with F_SETSIG(SIGURG) and O_ASYNC.
The other caller is still in the kernel after AF_UNIX MSG_OOB is removed. It is reachable from tcp_check_urg(), smc and x25:
sk_send_sigurg()
send_sigurg()
send_sigurg_to_task()
sigio_perm(p, fown, SIGURG)
The hook in security/landlock/task.c still names this caller:
hook_file_send_sigiotask() {
...
/* Lock already held by send_sigio() and send_sigurg(). */
lockdep_assert_held(&fown->lock);
...
}The trace section comment also still says "Trace test for the asynchronous SIGIO/SIGURG delivery path".
These tests would keep passing if send_sigurg_to_task() stopped calling sigio_perm(), or called it without fown->lock held. The later patches in this series (the sockmap and af_unix MSG_OOB test removals, and "af_unix:
Remove MSG_OOB") do not seem to add a replacement test for this path.
Could these tests use TCP urgent data over loopback instead? That reaches sk_send_sigurg() without AF_UNIX OOB. If not, could the sigurg_socket name and the comments be updated so they no longer claim send_sigurg() coverage?
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116021845.2533130-1-kuniyu%40google.com
Kuniyuki Iwashima
maintainerRe: [PATCH v1 net-next 1/4] selftests: landlock: Replace MSG_OOB with O_ASYNC+F_SETSIG.
Quoted 75 lines · On Tue, 17 Nov 2026 17:19:30 +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] After this patch, no landlock selftest reaches
hook_file_send_sigiotask()throughsend_sigurg().--
selftests: landlock: Replace
MSG_OOBwith O_ASYNC+F_SETSIG.This commit removes
MSG_OOBfrom the fown.sigurg_socket and trace_fown.deny_scope_fown tests. They now do a plainsend()to a socket withO_ASYNCandF_SETSIG(SIGURG)set, so they no longer depend onCONFIG_AF_UNIX_OOB. The commit also dropsCONFIG_AF_UNIX_OOBfrom the landlock selftest config, and it moves theclose()ofclient_socketlater so that no extraPOLL_HUPsignal is sent.Quoted 4 lines
tools/testing/selftests/landlock/scoped_signal_test.c +0
-0[ ... ]
tools/testing/selftests/landlock/scoped_signal_test.c TEST_F(fown, sigurg_socket) · line 547
Quoted 11 lines
tools/testing/selftests/landlock/scoped_signal_test.c +3
-1@@ -560,20 +539,22 @@ TEST_F(fown, sigurg_socket)create_scoped_domain (_metadata,LANDLOCK_SCOPE_SIGNAL );/* -* Sets the child to receive SIGURG for MSG_OOB. This uncommon use is +* Sets the child to receive SIGURG. This uncommon use is * a valid attack scenario which also simplifies this test. */ ASSERT_EQ (0 ,fcntl (recv_socket,F_SETOWN , child)); +ASSERT_EQ (0 ,fcntl (recv_socket,F_SETSIG ,SIGURG )); +ASSERT_EQ (0 ,fcntl (recv_socket,F_SETFL ,O_ASYNC ));[Severity: Low]
After this change, does any landlock selftest still reachhook_file_send_sigiotask()throughsend_sigurg()?fown.sigurg_socket and trace_fown.deny_scope_fown now reach the hook only through the
send_sigio()path:
sock_wake_async()
kill_fasync()
send_sigio()
send_sigio_to_task()
sigio_perm()The
sigio_to_pgid_membersandsigio_to_pgid_selftests in the same file already cover that path. They use a pipe withF_SETSIG(SIGURG)andO_ASYNC.The other caller is still in the kernel after
AF_UNIXMSG_OOBis removed. It is reachable fromtcp_check_urg(), smc and x25:
sk_send_sigurg()
send_sigurg()
send_sigurg_to_task()
sigio_perm(p, fown, SIGURG)The hook in
security/landlock/task.cstill names this caller:hook_file_send_sigiotask() { ... /* Lock already held by send_sigio() and send_sigurg(). */ lockdep_assert_held(&fown->lock); ... }The trace section comment also still says "Trace test for the asynchronous SIGIO/SIGURG delivery path".
Quoted 8 lines
These tests would keep passing if
send_sigurg_to_task()stopped callingsigio_perm(), or called it withoutfown->lockheld. The later patches in this series (the sockmap andaf_unixMSG_OOBtest removals, and "af_unix:
RemoveMSG_OOB") do not seem to add a replacement test for this path.Could these tests use TCP urgent data over loopback instead? That reaches
sk_send_sigurg()withoutAF_UNIXOOB. If not, could thesigurg_socketname and the comments be updated so they no longer claimsend_sigurg()coverage?
I don't think we want to play with TCP MSG_OOB nor smc/ax25 :)
also the intention of the selftest is not to test send_sigurg(), rather security_file_send_sigiotask().
Kuniyuki Iwashima
maintainerPATCH 2/4 selftests: bpf: sockmap: Remove AF_UNIX MSG_OOB test case.
In reply to Kuniyuki IwashimaWe will drop MSG_OOB support from AF_UNIX.
Let's remove the test case from sockmap_redir.
Note that struct socket_spec.send_flags is no longer used so removed too.
---
Cc: John Fastabend <[email protected]>
Cc: Jakub Sitnicki <[email protected]>
Cc: Jiayuan Chen <[email protected]>
Cc: [email protected]
--- .../selftests/bpf/prog_tests/sockmap_redir.c | 45 +++++-------------- 1 file changed, 11 insertions(+), 34 deletions(-)
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +11 -34
@@ -103,7 +103,6 @@ struct redir_spec {struct socket_spec {int family;int sotype; -int send_flags;int in[2 ];int out[2 ]; };
@@ -197,12 +196,12 @@ static void handle_unsupported(int sd_send, int sd_peer, int sd_in, int sd_out,try_recv ("bpf.recv(sd_recv)" , sd_recv,MSG_DONTWAIT , false); } -static void test_send_redir_recv (int sd_send,int send_flags,int sd_peer, +static void test_send_redir_recv (int sd_send,int sd_peer,int sd_in,int sd_out,int sd_recv,struct maps *maps,int status) {unsigned int drop, pass; -char *send_buf ="ab" ; +char *send_buf ="a" ;char recv_buf ='\0' ;ssize_t n, len =1 ;
@@ -217,10 +216,7 @@ static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,if (xbpf_map_update_elem (maps->out, &u32 (0 ), &u64 (sd_out),BPF_NOEXIST )) goto del_in; -/* Last byte is OOB data when send_flags has MSG_OOB bit set */ -if (send_flags &MSG_OOB ) - len++; - n =send (sd_send, send_buf, len, send_flags); + n =send (sd_send, send_buf, len,0 );if (n >=0 && n < len)FAIL ("incomplete send" );if (n <0 ) {
@@ -255,20 +251,6 @@ static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,if (recv_buf != send_buf[0 ])FAIL ("recv(): payload check, %02x != %02x" , recv_buf, send_buf[0 ]); -if (send_flags &MSG_OOB ) { -/* Fail reading OOB while in sockmap */ -try_recv ("bpf.recv(sd_out, MSG_OOB)" , sd_out, -MSG_OOB |MSG_DONTWAIT , false); - -/* Remove sd_out from sockmap */ -xbpf_map_delete_elem (maps->out, &u32 (0 )); - -/* Check that OOB was dropped on redirect */ -try_recv ("recv(sd_out, MSG_OOB)" , sd_out, -MSG_OOB |MSG_DONTWAIT , false); - - goto del_in; - } out:xbpf_map_delete_elem (maps->out, &u32 (0 )); del_in:
@@ -328,7 +310,7 @@ static void test_socket(enum bpf_map_type type, struct redir_spec *redir, struct maps *maps, struct socket_spec *s_in, struct socket_spec *s_out) { - int fd_in, fd_out, fd_send, fd_peer, fd_recv, flags, status; + int fd_in, fd_out, fd_send, fd_peer, fd_recv, status;const char *in_str, *out_str;char s[MAX_TEST_NAME ];
@@ -337,26 +319,24 @@ static void test_socket(enum bpf_map_type type, struct redir_spec *redir, fd_send = s_in->in[redir->idx_send]; fd_peer = s_in->in[redir->idx_send ^1 ]; fd_recv = s_out->out[redir->idx_recv]; - flags = s_in->send_flags; in_str =socket_kind_to_str (fd_in); out_str =socket_kind_to_str (fd_out); status =get_support_status (redir->prog_type, in_str, out_str);snprintf (s,sizeof (s), -"%-4s %-17s %-5s %s %-5s%6s" , -/* hash sk_skb-to-ingress u_str → v_str (OOB) */ +"%-4s %-17s %-5s %s %-5s" , +/* hash sk_skb-to-ingress u_str → v_str */ type ==BPF_MAP_TYPE_SOCKMAP ?"map" :"hash" , redir->name, in_str, status &SUPPORTED ?"→" :" " , - out_str, - (flags &MSG_OOB ) ?"(OOB)" :"" ); + out_str);if (!test__start_subtest (s))return ; -test_send_redir_recv (fd_send, flags, fd_peer, fd_in, fd_out, fd_recv, +test_send_redir_recv (fd_send, fd_peer, fd_in, fd_out, fd_recv, maps, status); }
@@ -365,12 +345,10 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir, {struct socket_spec *s, sockets[] = { {AF_INET ,SOCK_STREAM }, -// { AF_INET, SOCK_STREAM, MSG_OOB }, /* Known to be broken */ {AF_INET6 ,SOCK_STREAM }, {AF_INET ,SOCK_DGRAM }, {AF_INET6 ,SOCK_DGRAM }, {AF_UNIX ,SOCK_STREAM }, - {AF_UNIX ,SOCK_STREAM ,MSG_OOB }, {AF_UNIX ,SOCK_DGRAM },// { AF_UNIX, SOCK_SEQPACKET}, /* Unsupported BPF_MAP_UPDATE_ELEM */ {AF_VSOCK ,SOCK_STREAM },
@@ -392,10 +370,9 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir,struct socket_spec *out = &sockets[j];struct socket_spec *in = &sockets[i]; -/* Skip intra-proto and between variants */ -if (out->send_flags || - (in->family == out->family && - in->sotype == out->sotype)) +/* Skip intra-proto */ +if (in->family == out->family && + in->sotype == out->sotype)continue ;test_socket (type, redir, maps, in, out);
Signature · 1 line
2.56.0.611.g1030f0b940-goog
[email protected]
AI reviewRe: [PATCH v1 net-next 2/4] selftests: bpf: sockmap: Remove AF_UNIX MSG_OOB test case.
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you…
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In test_redir() and test_send_redir_recv() (tools/testing/selftests/bpf/prog_tests/sockmap_redir.c), the patch…
- [Low] At this commit, the only selftest covering AF_UNIX MSG_OOB with sockmap is gone: the { AF_UNIX, SOCK_STREAM, MSG_OOB } entry in…
--
selftests: bpf: sockmap: Remove AF_UNIX MSG_OOB test case.
This commit removes the AF_UNIX SOCK_STREAM MSG_OOB case from the sockmap_redir selftest, because MSG_OOB support is going to be dropped from AF_UNIX. It also removes the socket_spec.send_flags field, which is no longer used, and the OOB handling in test_send_redir_recv() and test_socket().
Quoted 4 lines
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +0
-0
[ ... ]
Quoted 8 lines
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +0
-4@@ -255,20 +251,6 @@ static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,if (recv_buf != send_buf[0 ])FAIL ("recv(): payload check, %02x != %02x" , recv_buf, send_buf[0 ]); -if (send_flags &MSG_OOB ) { -/* Fail reading OOB while in sockmap */ -try_recv ("bpf.recv(sd_out, MSG_OOB)" , sd_out, -MSG_OOB |MSG_DONTWAIT , false);
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer, · line 271
Quoted 10 lines
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +0
-10- -/* Remove sd_out from sockmap */ -xbpf_map_delete_elem (maps->out, &u32 (0 )); - -/* Check that OOB was dropped on redirect */ -try_recv ("recv(sd_out, MSG_OOB)" , sd_out, -MSG_OOB |MSG_DONTWAIT , false); - - goto del_in; - }
[Severity: Low]
With these assertions and the { AF_UNIX, SOCK_STREAM, MSG_OOB } entry in test_redir() removed, does any selftest still cover AF_UNIX MSG_OOB together with sockmap at this commit?
The kernel side is still present here. AF_UNIX send(MSG_OOB) still works, and unix_stream_bpf_recvmsg() still has the rejection:
net/unix/unix_bpf.c:unix_stream_bpf_recvmsg() {
...
if (flags & MSG_OOB)
return -EOPNOTSUPP;
...
}This seems to be intentional and only lasts until the end of the series. After the later patch "af_unix: Remove MSG_OOB.", unix_stream_sendmsg() and unix_dgram_sendmsg() return -EOPNOTSUPP for MSG_OOB, and the receive paths reject it as well. At that point, the "OOB dropped on redirect" behaviour checked here no longer exists, and the removed case would fail at send().
Removing the test before the feature looks like the right order. This note is only about the short coverage gap between the two patches.
[ ... ]
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c static void test_redir(enum bpf_map_type type, struct redir_spec *redir, · line 368
Quoted 5 lines
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +0
-1@@ -365,12 +345,10 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir, {struct socket_spec *s, sockets[] = { {AF_INET ,SOCK_STREAM }, -// { AF_INET, SOCK_STREAM, MSG_OOB }, /* Known to be broken */
[Severity: Low]
This isn't a bug, but the commit message only mentions the AF_UNIX case and send_flags:
Let's remove the test case from sockmap_redir.
Note that struct socket_spec.send_flags is no longer used so removed too.
This line also drops the commented-out TCP MSG_OOB entry and its "Known to be broken" note. The entry never ran, and without send_flags it could not stay as written: MSG_OOB would land in in[0].
Would it be worth mentioning in the commit message that the in-tree note about TCP plus sockmap OOB being broken is removed as well?
Quoted 6 lines
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +0
-1{ AF_INET6, SOCK_STREAM }, { AF_INET, SOCK_DGRAM }, { AF_INET6, SOCK_DGRAM }, { AF_UNIX, SOCK_STREAM }, - { AF_UNIX, SOCK_STREAM, MSG_OOB }, { AF_UNIX, SOCK_DGRAM },
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116021845.2533130-1-kuniyu%40google.com
Kuniyuki Iwashima
maintainerRe: [PATCH v1 net-next 2/4] selftests: bpf: sockmap: Remove AF_UNIX MSG_OOB test case.
Quoted 43 lines · On Tue, 17 Nov 2026 17:19:31 +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found more severe issue(s) in other patches of this series. This mail is only an FYI, in case you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In
test_redir()andtest_send_redir_recv()(tools/testing/selftests/bpf/prog_tests/sockmap_redir.c), the patch…
- [Low] At this commit, the only selftest coveringAF_UNIXMSG_OOBwith sockmap is gone: the{ AF_UNIX, SOCK_STREAM, MSG_OOB }entry in…--
selftests: bpf: sockmap: Remove
AF_UNIXMSG_OOBtest case.This commit removes the
AF_UNIXSOCK_STREAMMSG_OOBcase from thesockmap_redirselftest, becauseMSG_OOBsupport is going to be dropped fromAF_UNIX. It also removes the socket_spec.send_flags field, which is no longer used, and the OOB handling intest_send_redir_recv()andtest_socket().Quoted 4 lines
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +0
-0[ ... ]
Quoted 15 lines
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +0
-11@@ -255,20 +251,6 @@ static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,if (recv_buf != send_buf[0 ])FAIL ("recv(): payload check, %02x != %02x" , recv_buf, send_buf[0 ]); -if (send_flags &MSG_OOB ) { -/* Fail reading OOB while in sockmap */ -try_recv ("bpf.recv(sd_out, MSG_OOB)" , sd_out, -MSG_OOB |MSG_DONTWAIT , false); - -/* Remove sd_out from sockmap */ -xbpf_map_delete_elem (maps->out, &u32 (0 )); - -/* Check that OOB was dropped on redirect */ -try_recv ("recv(sd_out, MSG_OOB)" , sd_out, -MSG_OOB |MSG_DONTWAIT , false);
Quoted 8 lines
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer, · line 271
Quoted 3 lines
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +0
-3- - goto del_in; - }[Severity: Low]
With these assertions and the {AF_UNIX,SOCK_STREAM,MSG_OOB} entry intest_redir()removed, does any selftest still coverAF_UNIXMSG_OOBtogether with sockmap at this commit?
No test is needed anymore, I'm removing it.
Quoted 8 lines
The kernel side is still present here.
AF_UNIXsend(MSG_OOB)still works, andunix_stream_bpf_recvmsg()still has the rejection:net/unix/unix_bpf.c:unix_stream_bpf_recvmsg() { ... if (flags & MSG_OOB) return -EOPNOTSUPP;
This stays in unix_stream_sendmsg() too, but is not worth testing itself.
Quoted 48 lines
... }This seems to be intentional and only lasts until the end of the series. After the later patch "
af_unix: RemoveMSG_OOB.",unix_stream_sendmsg()andunix_dgram_sendmsg()return-EOPNOTSUPPforMSG_OOB, and the receive paths reject it as well. At that point, the "OOB dropped on redirect" behaviour checked here no longer exists, and the removed case would fail atsend().Removing the test before the feature looks like the right order. This note is only about the short coverage gap between the two patches.
[ ... ]
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c static void test_redir(enum bpf_map_type type, struct redir_spec *redir, · line 368
Quoted 5 lines
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +0
-1@@ -365,12 +345,10 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir, {struct socket_spec *s, sockets[] = { {AF_INET ,SOCK_STREAM }, -// { AF_INET, SOCK_STREAM, MSG_OOB }, /* Known to be broken */ [Severity: Low]
This isn't a bug, but the commit message only mentions theAF_UNIXcase andsend_flags:Let's remove the test case from
sockmap_redir.Note that struct socket_spec.send_flags is no longer used so removed too.
This line also drops the commented-out TCP
MSG_OOBentry and its "Known to be broken" note. The entry never ran, and withoutsend_flagsit could not stay as written:MSG_OOBwould land in in[0].Would it be worth mentioning in the commit message that the in-tree note about TCP plus sockmap OOB being broken is removed as well?
Quoted 6 lines
tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +0
-1{ AF_INET6, SOCK_STREAM }, { AF_INET, SOCK_DGRAM }, { AF_INET6, SOCK_DGRAM }, { AF_UNIX, SOCK_STREAM }, - { AF_UNIX, SOCK_STREAM, MSG_OOB }, { AF_UNIX, SOCK_DGRAM },[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116021845.2533130-1-kuniyu%40google.com
Re: [PATCH v1 net-next 2/4] selftests: bpf: sockmap: Remove AF_UNIX MSG_OOB test case.
In reply to Kuniyuki IwashimaQuoted 8 lines · Kuniyuki Iwashima
We will drop
MSG_OOBsupport fromAF_UNIX.Let's remove the test case from
sockmap_redir.Note that struct socket_spec.send_flags is no longer used so removed too.
Signed-off-by Kuniyuki Iwashima <[email protected]>
Quoted 136 lines
---
Cc: John Fastabend <[email protected]>
Cc: Jakub Sitnicki <[email protected]>
Cc: Jiayuan Chen <[email protected]>
Cc: [email protected]--- .../selftests/bpf/prog_tests/sockmap_redir.c | 45 +++++-------------- 1 file changed, 11 insertions(+), 34 deletions(-)tools/testing/selftests/bpf/prog_tests/sockmap_redir.c +11
-34@@ -103,7 +103,6 @@ struct redir_spec {struct socket_spec {int family;int sotype; -int send_flags;int in[2 ];int out[2 ]; };@@ -197,12 +196,12 @@ static void handle_unsupported(int sd_send, int sd_peer, int sd_in, int sd_out,try_recv ("bpf.recv(sd_recv)" , sd_recv,MSG_DONTWAIT , false); } -static void test_send_redir_recv (int sd_send,int send_flags,int sd_peer, +static void test_send_redir_recv (int sd_send,int sd_peer,int sd_in,int sd_out,int sd_recv,struct maps *maps,int status) {unsigned int drop, pass; -char *send_buf ="ab" ; +char *send_buf ="a" ;char recv_buf ='\0' ;ssize_t n, len =1 ;@@ -217,10 +216,7 @@ static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,if (xbpf_map_update_elem (maps->out, &u32 (0 ), &u64 (sd_out),BPF_NOEXIST )) goto del_in; -/* Last byte is OOB data when send_flags has MSG_OOB bit set */ -if (send_flags &MSG_OOB ) - len++; - n =send (sd_send, send_buf, len, send_flags); + n =send (sd_send, send_buf, len,0 );if (n >=0 && n < len)FAIL ("incomplete send" );if (n <0 ) {@@ -255,20 +251,6 @@ static void test_send_redir_recv(int sd_send, int send_flags, int sd_peer,if (recv_buf != send_buf[0 ])FAIL ("recv(): payload check, %02x != %02x" , recv_buf, send_buf[0 ]); -if (send_flags &MSG_OOB ) { -/* Fail reading OOB while in sockmap */ -try_recv ("bpf.recv(sd_out, MSG_OOB)" , sd_out, -MSG_OOB |MSG_DONTWAIT , false); - -/* Remove sd_out from sockmap */ -xbpf_map_delete_elem (maps->out, &u32 (0 )); - -/* Check that OOB was dropped on redirect */ -try_recv ("recv(sd_out, MSG_OOB)" , sd_out, -MSG_OOB |MSG_DONTWAIT , false); - - goto del_in; - } out:xbpf_map_delete_elem (maps->out, &u32 (0 )); del_in:@@ -328,7 +310,7 @@ static void test_socket(enum bpf_map_type type, struct redir_spec *redir, struct maps *maps, struct socket_spec *s_in, struct socket_spec *s_out) { - int fd_in, fd_out, fd_send, fd_peer, fd_recv, flags, status; + int fd_in, fd_out, fd_send, fd_peer, fd_recv, status;const char *in_str, *out_str;char s[MAX_TEST_NAME ];@@ -337,26 +319,24 @@ static void test_socket(enum bpf_map_type type, struct redir_spec *redir, fd_send = s_in->in[redir->idx_send]; fd_peer = s_in->in[redir->idx_send ^1 ]; fd_recv = s_out->out[redir->idx_recv]; - flags = s_in->send_flags; in_str =socket_kind_to_str (fd_in); out_str =socket_kind_to_str (fd_out); status =get_support_status (redir->prog_type, in_str, out_str);snprintf (s,sizeof (s), -"%-4s %-17s %-5s %s %-5s%6s" , -/* hash sk_skb-to-ingress u_str → v_str (OOB) */ +"%-4s %-17s %-5s %s %-5s" , +/* hash sk_skb-to-ingress u_str → v_str */ type ==BPF_MAP_TYPE_SOCKMAP ?"map" :"hash" , redir->name, in_str, status &SUPPORTED ?"→" :" " , - out_str, - (flags &MSG_OOB ) ?"(OOB)" :"" ); + out_str);if (!test__start_subtest (s))return ; -test_send_redir_recv (fd_send, flags, fd_peer, fd_in, fd_out, fd_recv, +test_send_redir_recv (fd_send, fd_peer, fd_in, fd_out, fd_recv, maps, status); }@@ -365,12 +345,10 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir, {struct socket_spec *s, sockets[] = { {AF_INET ,SOCK_STREAM }, -// { AF_INET, SOCK_STREAM, MSG_OOB }, /* Known to be broken */ {AF_INET6 ,SOCK_STREAM }, {AF_INET ,SOCK_DGRAM }, {AF_INET6 ,SOCK_DGRAM }, {AF_UNIX ,SOCK_STREAM }, - {AF_UNIX ,SOCK_STREAM ,MSG_OOB }, {AF_UNIX ,SOCK_DGRAM },// { AF_UNIX, SOCK_SEQPACKET}, /* Unsupported BPF_MAP_UPDATE_ELEM */ {AF_VSOCK ,SOCK_STREAM },@@ -392,10 +370,9 @@ static void test_redir(enum bpf_map_type type, struct redir_spec *redir,struct socket_spec *out = &sockets[j];struct socket_spec *in = &sockets[i]; -/* Skip intra-proto and between variants */ -if (out->send_flags || - (in->family == out->family && - in->sotype == out->sotype)) +/* Skip intra-proto */ +if (in->family == out->family && + in->sotype == out->sotype)continue ;test_socket (type, redir, maps, in, out);
Kuniyuki Iwashima
maintainerPATCH 3/4 selftests: af_unix: Remove MSG_OOB tests.
In reply to Kuniyuki IwashimaWe will drop MSG_OOB support.
Let's remove msg_oob.c, MSG_OOB variants and flags field in scm_rights.c.
--- .../testing/selftests/net/af_unix/.gitignore | 1 - tools/testing/selftests/net/af_unix/Makefile | 1 - tools/testing/selftests/net/af_unix/config | 1 - tools/testing/selftests/net/af_unix/msg_oob.c | 958 ------------------ .../selftests/net/af_unix/scm_rights.c | 45 +- 5 files changed, 1 insertion(+), 1005 deletions(-) delete mode 100644 tools/testing/selftests/net/af_unix/msg_oob.c
tools/testing/selftests/net/af_unix/.gitignore +0 -1
@@ -1,5 +1,4 @@ diag_uid -msg_oob scm_inq scm_pidfd scm_rights
tools/testing/selftests/net/af_unix/Makefile +0 -1
@@ -7,7 +7,6 @@ CFLAGS += $(KHDR_INCLUDES) -Wall $(call cc-option,-Wflex-array-member-not-at-end TEST_GEN_PROGS := \ diag_uid \ - msg_oob \ scm_inq \ scm_pidfd \ scm_rights \
tools/testing/selftests/net/af_unix/config +0 -1
@@ -1,4 +1,3 @@ -CONFIG_AF_UNIX_OOB=y CONFIG_BPF=y CONFIG_BPF_EVENTS=y CONFIG_BPF_JIT=y
tools/testing/selftests/net/af_unix/msg_oob.c deleted +0 -958
958 lines not on this page · raw message
tools/testing/selftests/net/af_unix/scm_rights.c +1 -44
93 lines not on this page · raw message
Signature · 1 line
2.56.0.611.g1030f0b940-goog
Kuniyuki Iwashima
maintainerPATCH 4/4 af_unix: Remove MSG_OOB.
In reply to Kuniyuki IwashimaSecurity folks love MSG_OOB and it has had many bugs with CVEs assigned.
The volume of bugs from MSG_OOB led to CONFIG_AF_UNIX_OOB, but the default was 'y' even though there is no clear use case, exposing innocent users to security risks.
Most of such bugs are trivial if CONFIG_AF_UNIX_OOB is not enabled, but typically MSG_OOB allowed serious consequences, such as LPE.
Considering RFC 6093 deprecated MSG_OOB for TCP in 2011, we should not have accepted it for AF_UNIX from day 1.
It is time to drop support.
Along with that, ioctl(SIOCATMARK), EPOLLPRI, etc become unavailable as if CONFIG_AF_UNIX_OOB=n.
--- include/net/af_unix.h | 3 - include/net/dropreason-core.h | 6 - net/unix/Kconfig | 7 - net/unix/af_unix.c | 252 +--------------------------------- 4 files changed, 1 insertion(+), 267 deletions(-)
include/net/af_unix.h +0 -3
@@ -50,9 +50,6 @@ struct unix_sock {int inq_len;bool recvmsg_inq;bool scm_rights_notrunc; -#if IS_ENABLED (CONFIG_AF_UNIX_OOB ) -struct sk_buff *oob_skb; -#endif };#define unix_sk (ptr) container_of_const(ptr, struct unix_sock, sk)
include/net/dropreason-core.h +0 -6
@@ -10,7 +10,6 @@ FN(SOCKET_FILTER) \ FN(SOCKET_RCVBUFF) \ FN(UNIX_DISCONNECT) \ - FN(UNIX_SKIP_OOB) \ FN(PKT_TOO_SMALL) \ FN(TCP_CSUM) \ FN(UDP_CSUM) \
@@ -164,11 +163,6 @@ enum skb_drop_reason {* during send() that the peer has been close()d. */ SKB_DROP_REASON_UNIX_DISCONNECT , -/** -* @SKB_DROP_REASON_UNIX_SKIP_OOB: Out-Of-Band data is skipped by -* recv() without MSG_OOB so dropped. -*/ -SKB_DROP_REASON_UNIX_SKIP_OOB ,/** @SKB_DROP_REASON_PKT_TOO_SMALL: packet size is too small */ SKB_DROP_REASON_PKT_TOO_SMALL,/** @SKB_DROP_REASON_TCP_CSUM: TCP checksum error */
net/unix/Kconfig +0 -7
@@ -16,13 +16,6 @@ config UNIX Say Y unless you know what you are doing. -config AF_UNIX_OOB - bool "UNIX: out-of-bound messages" - depends on UNIX - default y - help - Support for MSG_OOB in UNIX domain sockets. If unsure, say Y. - config UNIX_DIAG tristate "UNIX: socket monitoring interface" depends on UNIX
net/unix/af_unix.c +1 -251
318 lines not on this page · raw message
Signature · 1 line
2.56.0.611.g1030f0b940-goog
[email protected]
AI reviewRe: [PATCH v1 net-next 4/4] af_unix: Remove MSG_OOB.
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] This patch removes a userspace-visible AF_UNIX feature with no deprecation step and no evidence that nobody uses it.
--
af_unix: Remove MSG_OOB.
This patch removes MSG_OOB support from AF_UNIX stream sockets. It also removes the CONFIG_AF_UNIX_OOB option, the oob_skb field in struct unix_sock and the SKB_DROP_REASON_UNIX_SKIP_OOB drop reason. After it, ioctl(SIOCATMARK), EPOLLPRI and SIGURG on AF_UNIX behave as if CONFIG_AF_UNIX_OOB=n.
Quoted 22 lines
net/unix/Kconfig +0
-7@@ -16,13 +16,6 @@ config UNIX Say Y unless you know what you are doing. -config AF_UNIX_OOB - bool "UNIX: out-of-bound messages" - depends on UNIX - default y - help - Support for MSG_OOB in UNIX domain sockets. If unsure, say Y. - config UNIX_DIAG tristate "UNIX: socket monitoring interface" depends on UNIXnet/unix/af_unix.c +0
-0
[ ... ]
net/unix/af_unix.c static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, · line 2338
Quoted 12 lines
net/unix/af_unix.c +1
-6@@ -2403,12 +2334,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,if (msg->msg_flags &MSG_OOB ) { err = -EOPNOTSUPP ; -#if IS_ENABLED (CONFIG_AF_UNIX_OOB ) -if (len) - len--; - else -#endif - goto out_err; + goto out_err; }
[Severity: Medium]
Could this break existing userspace on kernels built with the default config?
The removed AF_UNIX_OOB option was default y, and its help text said "If unsure, say Y". So most kernels since v5.15 have shipped MSG_OOB support for AF_UNIX SOCK_STREAM sockets. On those kernels:
send(MSG_OOB) queued a 1-byte OOB skb and raised SIGURG on the peer through sk_send_sigurg() in queue_oob()
recv(MSG_OOB) read the byte back through unix_stream_recv_urg()
ioctl(SIOCATMARK) reported the mark
unix_poll() returned EPOLLPRI
After this patch, an unprivileged process that calls send() or recv() with MSG_OOB on a connected AF_UNIX SOCK_STREAM socket always gets -EOPNOTSUPP. The send side fails in unix_stream_sendmsg() and the recv side fails in unix_stream_read_generic(). SIOCATMARK now falls through to -ENOIOCTLCMD in unix_ioctl(), and EPOLLPRI and SIGURG are never generated.
The commit message says plainly that these features go away. Its only argument that nobody depends on them is "there is no clear use case". Is there evidence that no userspace relies on this behaviour?
Would it be safer to first switch AF_UNIX_OOB to default n, or to warn on use, for a few releases before deleting the symbol? With the option removed outright, anyone who hits a regression has no way to turn the feature back on.
Inside the tree, the series looks consistent. Earlier patches remove or rewrite the selftests that used MSG_OOB: af_unix msg_oob.c and scm_rights.c, the bpf sockmap_redir case, and the landlock scoped_signal_test. No references to AF_UNIX_OOB, UNIX_SKIP_OOB or oob_skb remain.
[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116021845.2533130-1-kuniyu%40google.com
Kuniyuki Iwashima
maintainerRe: [PATCH v1 net-next 4/4] af_unix: Remove MSG_OOB.
Quoted 51 lines · On Tue, 17 Nov 2026 17:19:32 +0000, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough).
- [Medium] This patch removes a userspace-visible
AF_UNIXfeature with no deprecation step and no evidence that nobody uses it.--
af_unix: RemoveMSG_OOB.This patch removes
MSG_OOBsupport fromAF_UNIXstream sockets. It also removes theCONFIG_AF_UNIX_OOBoption, theoob_skbfield in structunix_sockand theSKB_DROP_REASON_UNIX_SKIP_OOBdrop reason. After it, ioctl(SIOCATMARK), EPOLLPRI and SIGURG onAF_UNIXbehave as ifCONFIG_AF_UNIX_OOB=n.Quoted 22 lines
net/unix/Kconfig +0
-7@@ -16,13 +16,6 @@ config UNIX Say Y unless you know what you are doing. -config AF_UNIX_OOB - bool "UNIX: out-of-bound messages" - depends on UNIX - default y - help - Support for MSG_OOB in UNIX domain sockets. If unsure, say Y. - config UNIX_DIAG tristate "UNIX: socket monitoring interface" depends on UNIXnet/unix/af_unix.c +0
-0[ ... ]
Quoted 2 lines
net/unix/af_unix.c +0
-0@@ -2403,12 +2334,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg,
Quoted 14 lines
net/unix/af_unix.c static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, · line 2338
Quoted 10 lines
net/unix/af_unix.c +1
-6if (msg->msg_flags &MSG_OOB ) { err = -EOPNOTSUPP ; -#if IS_ENABLED (CONFIG_AF_UNIX_OOB ) -if (len) - len--; - else -#endif - goto out_err; + goto out_err; }[Severity: Medium]
Could this break existing userspace on kernels built with the default config?
Only if there is a user, but I don't think so. If there were real users, they would have comlained about many uAPI changes. It's only security researchers who actually "use" MSG_OOB.
Quoted 40 lines
The removed
AF_UNIX_OOBoption was default y, and its help text said "If unsure, say Y". So most kernels since v5.15 have shippedMSG_OOBsupport forAF_UNIXSOCK_STREAMsockets. On those kernels:
send(MSG_OOB)queued a 1-byte OOB skb and raised SIGURG on the peer throughsk_send_sigurg()inqueue_oob()
recv(MSG_OOB)read the byte back throughunix_stream_recv_urg()ioctl(SIOCATMARK) reported the mark
unix_poll()returned EPOLLPRIAfter this patch, an unprivileged process that calls
send()orrecv()withMSG_OOBon a connectedAF_UNIXSOCK_STREAMsocket always gets-EOPNOTSUPP. The send side fails inunix_stream_sendmsg()and the recv side fails inunix_stream_read_generic(). SIOCATMARK now falls through to-ENOIOCTLCMDinunix_ioctl(), and EPOLLPRI and SIGURG are never generated.The commit message says plainly that these features go away. Its only argument that nobody depends on them is "there is no clear use case". Is there evidence that no userspace relies on this behaviour?
Would it be safer to first switch
AF_UNIX_OOBto default n, or to warn on use, for a few releases before deleting the symbol? With the option removed outright, anyone who hits a regression has no way to turn the feature back on.Inside the tree, the series looks consistent. Earlier patches remove or rewrite the selftests that used
MSG_OOB:af_unixmsg_oob.candscm_rights.c, the bpfsockmap_redircase, and the landlockscoped_signal_test. No references toAF_UNIX_OOB,UNIX_SKIP_OOBoroob_skbremain.[ ... ]
Signature · 1 line
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116021845.2533130-1-kuniyu%40google.com
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 8 lines · On Mon, 16 Nov 2026 02:18:17 +0000 you wrote:
MSG_OOBimplementation is quite buggy and has received many CVEs, which led toCONFIG_AF_UNIX_OOB, but the default is 'y' so it is enabled by major distros, even though there is no clear use case.In addition, such bugs have changed user-visible
MSG_OOBbehaviour many times, but no one complained about that.[...]
Here is the summary with links:
- [v1,net-next,1/4] selftests: landlock: Replace MSG_OOB with O_ASYNC+F_SETSIG.
https://git.kernel.org/netdev/net-next/c/e0fa647fd313 - [v1,net-next,2/4] selftests: bpf: sockmap: Remove AF_UNIX MSG_OOB test case. https://git.kernel.org/netdev/net-next/c/30eb4baebfde - [v1,net-next,3/4] selftests: af_unix: Remove MSG_OOB tests. https://git.kernel.org/netdev/net-next/c/f4dc608a4bd1 - [v1,net-next,4/4] af_unix: Remove MSG_OOB. https://git.kernel.org/netdev/net-next/c/387f48167305
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html