From: Greg Kroah-Hartman Date: Mon, 11 Apr 2022 11:35:13 +0000 (+0200) Subject: 5.16-stable patches X-Git-Tag: v4.9.310~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a0bf79996178c85b8e3081debc579ea43fe1f6ae;p=thirdparty%2Fkernel%2Fstable-queue.git 5.16-stable patches added patches: bpf-make-remote_port-field-in-struct-bpf_sk_lookup-16-bit-wide.patch drm-amdkfd-fix-variable-set-but-not-used-warning.patch net-smc-send-directly-on-setting-tcp_nodelay.patch revert-selftests-net-add-tls-config-dependency-for-tls-selftests.patch selftests-bpf-fix-u8-narrow-load-checks-for-bpf_sk_lookup-remote_port.patch --- diff --git a/queue-5.16/bpf-make-remote_port-field-in-struct-bpf_sk_lookup-16-bit-wide.patch b/queue-5.16/bpf-make-remote_port-field-in-struct-bpf_sk_lookup-16-bit-wide.patch new file mode 100644 index 00000000000..ac1c5c84927 --- /dev/null +++ b/queue-5.16/bpf-make-remote_port-field-in-struct-bpf_sk_lookup-16-bit-wide.patch @@ -0,0 +1,79 @@ +From 9a69e2b385f443f244a7e8b8bcafe5ccfb0866b4 Mon Sep 17 00:00:00 2001 +From: Jakub Sitnicki +Date: Wed, 9 Feb 2022 19:43:32 +0100 +Subject: bpf: Make remote_port field in struct bpf_sk_lookup 16-bit wide + +From: Jakub Sitnicki + +commit 9a69e2b385f443f244a7e8b8bcafe5ccfb0866b4 upstream. + +remote_port is another case of a BPF context field documented as a 32-bit +value in network byte order for which the BPF context access converter +generates a load of a zero-padded 16-bit integer in network byte order. + +First such case was dst_port in bpf_sock which got addressed in commit +4421a582718a ("bpf: Make dst_port field in struct bpf_sock 16-bit wide"). + +Loading 4-bytes from the remote_port offset and converting the value with +bpf_ntohl() leads to surprising results, as the expected value is shifted +by 16 bits. + +Reduce the confusion by splitting the field in two - a 16-bit field holding +a big-endian integer, and a 16-bit zero-padding anonymous field that +follows it. + +Suggested-by: Alexei Starovoitov +Signed-off-by: Jakub Sitnicki +Signed-off-by: Alexei Starovoitov +Link: https://lore.kernel.org/bpf/20220209184333.654927-2-jakub@cloudflare.com +Signed-off-by: Greg Kroah-Hartman +--- + include/uapi/linux/bpf.h | 3 ++- + net/bpf/test_run.c | 4 ++-- + net/core/filter.c | 3 ++- + 3 files changed, 6 insertions(+), 4 deletions(-) + +--- a/include/uapi/linux/bpf.h ++++ b/include/uapi/linux/bpf.h +@@ -6293,7 +6293,8 @@ struct bpf_sk_lookup { + __u32 protocol; /* IP protocol (IPPROTO_TCP, IPPROTO_UDP) */ + __u32 remote_ip4; /* Network byte order */ + __u32 remote_ip6[4]; /* Network byte order */ +- __u32 remote_port; /* Network byte order */ ++ __be16 remote_port; /* Network byte order */ ++ __u16 :16; /* Zero padding */ + __u32 local_ip4; /* Network byte order */ + __u32 local_ip6[4]; /* Network byte order */ + __u32 local_port; /* Host byte order */ +--- a/net/bpf/test_run.c ++++ b/net/bpf/test_run.c +@@ -960,7 +960,7 @@ int bpf_prog_test_run_sk_lookup(struct b + if (!range_is_zero(user_ctx, offsetofend(typeof(*user_ctx), local_port), sizeof(*user_ctx))) + goto out; + +- if (user_ctx->local_port > U16_MAX || user_ctx->remote_port > U16_MAX) { ++ if (user_ctx->local_port > U16_MAX) { + ret = -ERANGE; + goto out; + } +@@ -968,7 +968,7 @@ int bpf_prog_test_run_sk_lookup(struct b + ctx.family = (u16)user_ctx->family; + ctx.protocol = (u16)user_ctx->protocol; + ctx.dport = (u16)user_ctx->local_port; +- ctx.sport = (__force __be16)user_ctx->remote_port; ++ ctx.sport = user_ctx->remote_port; + + switch (ctx.family) { + case AF_INET: +--- a/net/core/filter.c ++++ b/net/core/filter.c +@@ -10563,7 +10563,8 @@ static bool sk_lookup_is_valid_access(in + case bpf_ctx_range(struct bpf_sk_lookup, local_ip4): + case bpf_ctx_range_till(struct bpf_sk_lookup, remote_ip6[0], remote_ip6[3]): + case bpf_ctx_range_till(struct bpf_sk_lookup, local_ip6[0], local_ip6[3]): +- case bpf_ctx_range(struct bpf_sk_lookup, remote_port): ++ case offsetof(struct bpf_sk_lookup, remote_port) ... ++ offsetof(struct bpf_sk_lookup, local_ip4) - 1: + case bpf_ctx_range(struct bpf_sk_lookup, local_port): + bpf_ctx_record_field_size(info, sizeof(__u32)); + return bpf_ctx_narrow_access_ok(off, size, sizeof(__u32)); diff --git a/queue-5.16/drm-amdkfd-fix-variable-set-but-not-used-warning.patch b/queue-5.16/drm-amdkfd-fix-variable-set-but-not-used-warning.patch new file mode 100644 index 00000000000..7dd41748bc1 --- /dev/null +++ b/queue-5.16/drm-amdkfd-fix-variable-set-but-not-used-warning.patch @@ -0,0 +1,44 @@ +From 90c44207cdd18091ac9aa7cab8a3e7b0ef00e847 Mon Sep 17 00:00:00 2001 +From: Philip Yang +Date: Fri, 28 Jan 2022 09:26:30 -0500 +Subject: drm/amdkfd: Fix variable set but not used warning + +From: Philip Yang + +commit 90c44207cdd18091ac9aa7cab8a3e7b0ef00e847 upstream. + +All warnings (new ones prefixed by >>): + + drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c: In function +'svm_range_deferred_list_work': +>> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:2067:22: warning: +variable 'p' set but not used [-Wunused-but-set-variable] + 2067 | struct kfd_process *p; + | + +Fixes: 367c9b0f1b8750 ("drm/amdkfd: Ensure mm remain valid in svm deferred_list work") +Reported-by: kernel test robot +Signed-off-by: Philip Yang +Reviewed-By: Harish Kasiviswanathan +Signed-off-by: Alex Deucher +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 --- + 1 file changed, 3 deletions(-) + +--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c ++++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +@@ -2008,13 +2008,10 @@ static void svm_range_deferred_list_work + struct svm_range_list *svms; + struct svm_range *prange; + struct mm_struct *mm; +- struct kfd_process *p; + + svms = container_of(work, struct svm_range_list, deferred_list_work); + pr_debug("enter svms 0x%p\n", svms); + +- p = container_of(svms, struct kfd_process, svms); +- + spin_lock(&svms->deferred_list_lock); + while (!list_empty(&svms->deferred_range_list)) { + prange = list_first_entry(&svms->deferred_range_list, diff --git a/queue-5.16/net-smc-send-directly-on-setting-tcp_nodelay.patch b/queue-5.16/net-smc-send-directly-on-setting-tcp_nodelay.patch new file mode 100644 index 00000000000..d30f9f307af --- /dev/null +++ b/queue-5.16/net-smc-send-directly-on-setting-tcp_nodelay.patch @@ -0,0 +1,39 @@ +From b70a5cc045197aad9c159042621baf3c015f6cc7 Mon Sep 17 00:00:00 2001 +From: Dust Li +Date: Tue, 1 Mar 2022 17:43:59 +0800 +Subject: net/smc: send directly on setting TCP_NODELAY + +From: Dust Li + +commit b70a5cc045197aad9c159042621baf3c015f6cc7 upstream. + +In commit ea785a1a573b("net/smc: Send directly when +TCP_CORK is cleared"), we don't use delayed work +to implement cork. + +This patch use the same algorithm, removes the +delayed work when setting TCP_NODELAY and send +directly in setsockopt(). This also makes the +TCP_NODELAY the same as TCP. + +Cc: Tony Lu +Signed-off-by: Dust Li +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +--- + net/smc/af_smc.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/net/smc/af_smc.c ++++ b/net/smc/af_smc.c +@@ -2621,8 +2621,8 @@ static int smc_setsockopt(struct socket + sk->sk_state != SMC_CLOSED) { + if (val) { + SMC_STAT_INC(smc, ndly_cnt); +- mod_delayed_work(smc->conn.lgr->tx_wq, +- &smc->conn.tx_work, 0); ++ smc_tx_pending(&smc->conn); ++ cancel_delayed_work(&smc->conn.tx_work); + } + } + break; diff --git a/queue-5.16/revert-selftests-net-add-tls-config-dependency-for-tls-selftests.patch b/queue-5.16/revert-selftests-net-add-tls-config-dependency-for-tls-selftests.patch new file mode 100644 index 00000000000..b79169342c5 --- /dev/null +++ b/queue-5.16/revert-selftests-net-add-tls-config-dependency-for-tls-selftests.patch @@ -0,0 +1,35 @@ +From 20695e9a9fd39103d1b0669470ae74030b7aa196 Mon Sep 17 00:00:00 2001 +From: Jakub Kicinski +Date: Mon, 28 Mar 2022 14:29:04 -0700 +Subject: Revert "selftests: net: Add tls config dependency for tls selftests" + +From: Jakub Kicinski + +commit 20695e9a9fd39103d1b0669470ae74030b7aa196 upstream. + +This reverts commit d9142e1cf3bbdaf21337767114ecab26fe702d47. + +The test is supposed to run cleanly with TLS is disabled, +to test compatibility with TCP behavior. I can't repro +the failure [1], the problem should be debugged rather +than papered over. + +Link: https://lore.kernel.org/all/20220325161203.7000698c@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com/ [1] +Fixes: d9142e1cf3bb ("selftests: net: Add tls config dependency for tls selftests") +Signed-off-by: Jakub Kicinski +Link: https://lore.kernel.org/r/20220328212904.2685395-1-kuba@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/net/config | 1 - + 1 file changed, 1 deletion(-) + +--- a/tools/testing/selftests/net/config ++++ b/tools/testing/selftests/net/config +@@ -43,6 +43,5 @@ CONFIG_NET_ACT_TUNNEL_KEY=m + CONFIG_NET_ACT_MIRRED=m + CONFIG_BAREUDP=m + CONFIG_IPV6_IOAM6_LWTUNNEL=y +-CONFIG_TLS=m + CONFIG_CRYPTO_SM4=y + CONFIG_AMT=m diff --git a/queue-5.16/selftests-bpf-fix-u8-narrow-load-checks-for-bpf_sk_lookup-remote_port.patch b/queue-5.16/selftests-bpf-fix-u8-narrow-load-checks-for-bpf_sk_lookup-remote_port.patch new file mode 100644 index 00000000000..a8122352006 --- /dev/null +++ b/queue-5.16/selftests-bpf-fix-u8-narrow-load-checks-for-bpf_sk_lookup-remote_port.patch @@ -0,0 +1,65 @@ +From 3c69611b8926f8e74fcf76bd97ae0e5dafbeb26a Mon Sep 17 00:00:00 2001 +From: Jakub Sitnicki +Date: Sat, 19 Mar 2022 19:33:55 +0100 +Subject: selftests/bpf: Fix u8 narrow load checks for bpf_sk_lookup remote_port + +From: Jakub Sitnicki + +commit 3c69611b8926f8e74fcf76bd97ae0e5dafbeb26a upstream. + +In commit 9a69e2b385f4 ("bpf: Make remote_port field in struct +bpf_sk_lookup 16-bit wide") ->remote_port field changed from __u32 to +__be16. + +However, narrow load tests which exercise 1-byte sized loads from +offsetof(struct bpf_sk_lookup, remote_port) were not adopted to reflect the +change. + +As a result, on little-endian we continue testing loads from addresses: + + - (__u8 *)&ctx->remote_port + 3 + - (__u8 *)&ctx->remote_port + 4 + +which map to the zero padding following the remote_port field, and don't +break the tests because there is no observable change. + +While on big-endian, we observe breakage because tests expect to see zeros +for values loaded from: + + - (__u8 *)&ctx->remote_port - 1 + - (__u8 *)&ctx->remote_port - 2 + +Above addresses map to ->remote_ip6 field, which precedes ->remote_port, +and are populated during the bpf_sk_lookup IPv6 tests. + +Unsurprisingly, on s390x we observe: + + #136/38 sk_lookup/narrow access to ctx v4:OK + #136/39 sk_lookup/narrow access to ctx v6:FAIL + +Fix it by removing the checks for 1-byte loads from offsets outside of the +->remote_port field. + +Fixes: 9a69e2b385f4 ("bpf: Make remote_port field in struct bpf_sk_lookup 16-bit wide") +Suggested-by: Ilya Leoshkevich +Signed-off-by: Jakub Sitnicki +Signed-off-by: Alexei Starovoitov +Acked-by: Martin KaFai Lau +Link: https://lore.kernel.org/bpf/20220319183356.233666-3-jakub@cloudflare.com +Signed-off-by: Greg Kroah-Hartman +--- + tools/testing/selftests/bpf/progs/test_sk_lookup.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +--- a/tools/testing/selftests/bpf/progs/test_sk_lookup.c ++++ b/tools/testing/selftests/bpf/progs/test_sk_lookup.c +@@ -404,8 +404,7 @@ int ctx_narrow_access(struct bpf_sk_look + + /* Narrow loads from remote_port field. Expect SRC_PORT. */ + if (LSB(ctx->remote_port, 0) != ((SRC_PORT >> 0) & 0xff) || +- LSB(ctx->remote_port, 1) != ((SRC_PORT >> 8) & 0xff) || +- LSB(ctx->remote_port, 2) != 0 || LSB(ctx->remote_port, 3) != 0) ++ LSB(ctx->remote_port, 1) != ((SRC_PORT >> 8) & 0xff)) + return SK_DROP; + if (LSW(ctx->remote_port, 0) != SRC_PORT) + return SK_DROP; diff --git a/queue-5.16/series b/queue-5.16/series index a87649e73cd..f209c7e5190 100644 --- a/queue-5.16/series +++ b/queue-5.16/series @@ -258,3 +258,8 @@ drm-amdkfd-create-file-descriptor-after-client-is-added-to-smi_clients-list.patc drm-amdgpu-don-t-use-baco-for-reset-in-s3.patch sunrpc-ensure-we-flush-any-closed-sockets-before-xs_xprt_free.patch kvm-svm-allow-avic-support-on-system-w-physical-apic-id-255.patch +drm-amdkfd-fix-variable-set-but-not-used-warning.patch +net-smc-send-directly-on-setting-tcp_nodelay.patch +revert-selftests-net-add-tls-config-dependency-for-tls-selftests.patch +bpf-make-remote_port-field-in-struct-bpf_sk_lookup-16-bit-wide.patch +selftests-bpf-fix-u8-narrow-load-checks-for-bpf_sk_lookup-remote_port.patch