diff --git a/patches.suse/af_unix-Rename-UNIX-DGRAM-to-UNIX-to-maintain-backwa.patch b/patches.suse/af_unix-Rename-UNIX-DGRAM-to-UNIX-to-maintain-backwa.patch new file mode 100644 index 0000000..0207ad5 --- /dev/null +++ b/patches.suse/af_unix-Rename-UNIX-DGRAM-to-UNIX-to-maintain-backwa.patch @@ -0,0 +1,50 @@ +From: Stephen Boyd +Date: Fri, 8 Oct 2021 14:59:45 -0700 +Subject: af_unix: Rename UNIX-DGRAM to UNIX to maintain backwards + compatability + +Git-commit: 0edf0824e0dc359ed76bf96af986e6570ca2c0b9 +Patch-mainline: v5.15-rc6 +References: bsc#1206476 + +Then name of this protocol changed in commit 94531cfcbe79 ("af_unix: Add +unix_stream_proto for sockmap") because that commit added stream support +to the af_unix protocol. Renaming the existing protocol makes a ChromeOS +protocol test[1] fail now that the name has changed in +/proc/net/protocols from "UNIX" to "UNIX-DGRAM". + +Let's put the name back to how it was while keeping the stream protocol +as "UNIX-STREAM" so that the procfs interface doesn't change. This fixes +the test and maintains backwards compatibility in proc. + +Cc: Jiang Wang +Cc: Andrii Nakryiko +Cc: Cong Wang +Cc: Jakub Sitnicki +Cc: John Fastabend +Cc: Dmitry Osipenko +Link: https://source.chromium.org/chromiumos/chromiumos/codesearch/+/main:src/platform/tast-tests/src/chromiumos/tast/local/bundles/cros/network/supported_protocols.go;l=50;drc=e8b1c3f94cb40a054f4aa1ef1aff61e75dc38f18 [1] +Fixes: 94531cfcbe79 ("af_unix: Add unix_stream_proto for sockmap") +Signed-off-by: Stephen Boyd +Signed-off-by: David S. Miller +Signed-off-by: Yousaf Kaukab +--- + net/unix/af_unix.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c +index 0878ab86597b..89f9e85ae970 100644 +--- a/net/unix/af_unix.c ++++ b/net/unix/af_unix.c +@@ -828,7 +828,7 @@ static void unix_unhash(struct sock *sk) + } + + struct proto unix_dgram_proto = { +- .name = "UNIX-DGRAM", ++ .name = "UNIX", + .owner = THIS_MODULE, + .obj_size = sizeof(struct unix_sock), + .close = unix_close, +-- +2.35.3 + diff --git a/patches.suse/af_unix-fix-regression-in-read-after-shutdown.patch b/patches.suse/af_unix-fix-regression-in-read-after-shutdown.patch new file mode 100644 index 0000000..bf16821 --- /dev/null +++ b/patches.suse/af_unix-fix-regression-in-read-after-shutdown.patch @@ -0,0 +1,52 @@ +From: Vincent Whitchurch +Date: Fri, 19 Nov 2021 13:05:21 +0100 +Subject: af_unix: fix regression in read after shutdown + +Git-commit: f9390b249c90a15a4d9e69fbfb7a53c860b1fcaf +Patch-mainline: v5.16-rc3 +References: bsc#1206476 + +On kernels before v5.15, calling read() on a unix socket after +shutdown(SHUT_RD) or shutdown(SHUT_RDWR) would return the data +previously written or EOF. But now, while read() after +shutdown(SHUT_RD) still behaves the same way, read() after +shutdown(SHUT_RDWR) always fails with -EINVAL. + +This behaviour change was apparently inadvertently introduced as part of +a bug fix for a different regression caused by the commit adding sockmap +support to af_unix, commit 94531cfcbe79c359 ("af_unix: Add +unix_stream_proto for sockmap"). Those commits, for unclear reasons, +started setting the socket state to TCP_CLOSE on shutdown(SHUT_RDWR), +while this state change had previously only been done in +unix_release_sock(). + +Restore the original behaviour. The sockmap tests in +tests/selftests/bpf continue to pass after this patch. + +Fixes: d0c6416bd7091647f60 ("unix: Fix an issue in unix_shutdown causing the other end read/write failures") +Link: https://lore.kernel.org/lkml/20211111140000.GA10779@axis.com/ +Signed-off-by: Vincent Whitchurch +Tested-by: Casey Schaufler +Signed-off-by: David S. Miller +Signed-off-by: Yousaf Kaukab +--- + net/unix/af_unix.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c +index 78e08e82c08c..b0bfc78e421c 100644 +--- a/net/unix/af_unix.c ++++ b/net/unix/af_unix.c +@@ -2882,9 +2882,6 @@ static int unix_shutdown(struct socket *sock, int mode) + + unix_state_lock(sk); + sk->sk_shutdown |= mode; +- if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) && +- mode == SHUTDOWN_MASK) +- sk->sk_state = TCP_CLOSE; + other = unix_peer(sk); + if (other) + sock_hold(other); +-- +2.35.3 + diff --git a/patches.suse/unix-Fix-an-issue-in-unix_shutdown-causing-the-other.patch b/patches.suse/unix-Fix-an-issue-in-unix_shutdown-causing-the-other.patch new file mode 100644 index 0000000..7545f34 --- /dev/null +++ b/patches.suse/unix-Fix-an-issue-in-unix_shutdown-causing-the-other.patch @@ -0,0 +1,61 @@ +From: Jiang Wang +Date: Mon, 4 Oct 2021 23:25:28 +0000 +Subject: unix: Fix an issue in unix_shutdown causing the other end read/write + failures + +Git-commit: d0c6416bd7091647f6041599f396bfa19ae30368 +Patch-mainline: v5.15-rc5 +References: bsc#1206476 + +Commit 94531cfcbe79 ("af_unix: Add unix_stream_proto for sockmap") sets +unix domain socket peer state to TCP_CLOSE in unix_shutdown. This could +happen when the local end is shutdown but the other end is not. Then, +the other end will get read or write failures which is not expected. +Fix the issue by setting the local state to shutdown. + +Fixes: 94531cfcbe79 ("af_unix: Add unix_stream_proto for sockmap") +Reported-by: Casey Schaufler +Suggested-by: Cong Wang +Signed-off-by: Jiang Wang +Signed-off-by: Daniel Borkmann +Tested-by: Casey Schaufler +Reviewed-by: Casey Schaufler +Acked-by: Song Liu +Link: https://lore.kernel.org/bpf/20211004232530.2377085-1-jiang.wang@bytedance.com +Signed-off-by: Yousaf Kaukab +--- + net/unix/af_unix.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c +index f505b89bda6a..915afcae6a12 100644 +--- a/net/unix/af_unix.c ++++ b/net/unix/af_unix.c +@@ -2860,6 +2860,9 @@ static int unix_shutdown(struct socket *sock, int mode) + + unix_state_lock(sk); + sk->sk_shutdown |= mode; ++ if ((sk->sk_type == SOCK_STREAM || sk->sk_type == SOCK_SEQPACKET) && ++ mode == SHUTDOWN_MASK) ++ sk->sk_state = TCP_CLOSE; + other = unix_peer(sk); + if (other) + sock_hold(other); +@@ -2882,12 +2885,10 @@ static int unix_shutdown(struct socket *sock, int mode) + other->sk_shutdown |= peer_mode; + unix_state_unlock(other); + other->sk_state_change(other); +- if (peer_mode == SHUTDOWN_MASK) { ++ if (peer_mode == SHUTDOWN_MASK) + sk_wake_async(other, SOCK_WAKE_WAITD, POLL_HUP); +- other->sk_state = TCP_CLOSE; +- } else if (peer_mode & RCV_SHUTDOWN) { ++ else if (peer_mode & RCV_SHUTDOWN) + sk_wake_async(other, SOCK_WAKE_WAITD, POLL_IN); +- } + } + if (other) + sock_put(other); +-- +2.35.3 + diff --git a/series.conf b/series.conf index 79a625c..080af1f 100644 --- a/series.conf +++ b/series.conf @@ -5642,6 +5642,7 @@ patches.suse/bpf-Fix-integer-overflow-in-prealloc_elems_and_freel.patch patches.suse/libbpf-Fix-segfault-in-light-skeleton-for-objects-wi.patch patches.suse/libbpf-Fix-memory-leak-in-strset.patch + patches.suse/unix-Fix-an-issue-in-unix_shutdown-causing-the-other.patch patches.suse/net-prefer-socket-bound-to-interface-when-not-in-VRF.patch patches.suse/perf-jevents-Free-the-sys_event_tables-list-after-pr.patch patches.suse/cachefiles-Fix-oops-with-cachefiles_cull-due-to-NULL.patch @@ -5832,6 +5833,7 @@ patches.suse/qed-Fix-missing-error-code-in-qed_slowpath_start.patch patches.suse/net-phy-Do-not-shutdown-PHYs-in-READY-state.patch patches.suse/virtio-net-fix-for-skb_over_panic-inside-big-mode.patch + patches.suse/af_unix-Rename-UNIX-DGRAM-to-UNIX-to-maintain-backwa.patch patches.suse/net-dsa-mv88e6xxx-don-t-use-PHY_DETECT-on-internal-P.patch patches.suse/r8152-select-CRC32-and-CRYPTO-CRYPTO_HASH-CRYPTO_SHA.patch patches.suse/net-dsa-microchip-Added-the-condition-for-scheduling.patch @@ -11985,6 +11987,7 @@ patches.suse/iavf-Fix-deadlock-occurrence-during-resetting-VF-int.patch patches.suse/iavf-Fix-refreshing-iavf-adapter-stats-on-ethtool-re.patch patches.suse/iavf-Fix-VLAN-feature-flags-after-VFR.patch + patches.suse/af_unix-fix-regression-in-read-after-shutdown.patch patches.suse/net-dsa-qca8k-fix-MTU-calculation.patch patches.suse/nfp-checking-parameter-process-for-rx-usecs-tx-usecs.patch patches.suse/net-stmmac-retain-PTP-clock-time-during-SIOCSHWTSTAM.patch