]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Jun 2023 17:13:09 +0000 (19:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 22 Jun 2023 17:13:09 +0000 (19:13 +0200)
added patches:
selftests-mptcp-join-fix-userspace-pm-add-remove-address.patch
selftests-mptcp-join-skip-fail-tests-if-not-supported.patch
selftests-mptcp-join-skip-test-if-iptables-tc-cmds-fail.patch
selftests-mptcp-join-skip-userspace-pm-tests-if-not-supported.patch

queue-6.1/selftests-mptcp-join-fix-userspace-pm-add-remove-address.patch [new file with mode: 0644]
queue-6.1/selftests-mptcp-join-skip-fail-tests-if-not-supported.patch [new file with mode: 0644]
queue-6.1/selftests-mptcp-join-skip-test-if-iptables-tc-cmds-fail.patch [new file with mode: 0644]
queue-6.1/selftests-mptcp-join-skip-userspace-pm-tests-if-not-supported.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/selftests-mptcp-join-fix-userspace-pm-add-remove-address.patch b/queue-6.1/selftests-mptcp-join-fix-userspace-pm-add-remove-address.patch
new file mode 100644 (file)
index 0000000..95e2f8b
--- /dev/null
@@ -0,0 +1,49 @@
+From stable-owner@vger.kernel.org Thu Jun 22 17:43:24 2023
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+Date: Thu, 22 Jun 2023 17:43:07 +0200
+Subject: selftests: mptcp: join: fix "userspace pm add & remove address"
+To: stable@vger.kernel.org, gregkh@linuxfoundation.org
+Cc: Geliang Tang <geliang.tang@suse.com>, mptcp@lists.linux.dev, Matthieu Baerts <matthieu.baerts@tessares.net>
+Message-ID: <20230622154307.3362179-1-matthieu.baerts@tessares.net>
+
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+
+It looks like this test was broken in v6.1 after the backport of commit
+48d73f609dcc ("selftests: mptcp: update userspace pm addr tests").
+
+It was not working because the commit ad3493746ebe ("selftests: mptcp:
+add test-cases for mixed v4/v6 subflows") is not in v6.1. This commit
+changes how the connections are being created in mptcp_join.sh selftest:
+with IPv6 support always enabled. But then in v6.1, the server still
+create IPv4 only connections, so without the v4-mapped-v6 format with
+the "::ffff:" prefix like we have in v6.3.
+
+The modification here adds a support for connections created in v4 as
+well so it fixes the issue in v6.1. This patch is not needed for the
+selftests in v6.3 because only IPv6 listening sockets are being created.
+
+Fixes: 8f0ba8ec18f5 ("selftests: mptcp: update userspace pm addr tests")
+Cc: stable@vger.kernel.org
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/net/mptcp/mptcp_join.sh |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -946,11 +946,12 @@ do_transfer()
+                               sp=$(grep "type:10" "$evts_ns1" |
+                                    sed -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
+                               da=$(grep "type:10" "$evts_ns1" |
+-                                   sed -n 's/.*\(daddr6:\)\([0-9a-f:.]*\).*$/\2/p;q')
++                                   sed -n 's/.*\(daddr[46]:\)\([0-9a-f:.]*\).*$/\2/p;q')
++                              echo "$da" | grep -q ":" && addr="::ffff:$addr"
+                               dp=$(grep "type:10" "$evts_ns1" |
+                                    sed -n 's/.*\(dport:\)\([[:digit:]]*\).*$/\2/p;q')
+                               ip netns exec ${listener_ns} ./pm_nl_ctl rem token $tk id $id
+-                              ip netns exec ${listener_ns} ./pm_nl_ctl dsf lip "::ffff:$addr" \
++                              ip netns exec ${listener_ns} ./pm_nl_ctl dsf lip "$addr" \
+                                                       lport $sp rip $da rport $dp token $tk
+                       fi
diff --git a/queue-6.1/selftests-mptcp-join-skip-fail-tests-if-not-supported.patch b/queue-6.1/selftests-mptcp-join-skip-fail-tests-if-not-supported.patch
new file mode 100644 (file)
index 0000000..5040caf
--- /dev/null
@@ -0,0 +1,45 @@
+From matthieu.baerts@tessares.net Thu Jun 22 12:40:10 2023
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+Date: Thu, 22 Jun 2023 12:40:01 +0200
+Subject: selftests: mptcp: join: skip fail tests if not supported
+To: stable@vger.kernel.org, gregkh@linuxfoundation.org
+Cc: Matthieu Baerts <matthieu.baerts@tessares.net>, Jakub Kicinski <kuba@kernel.org>
+Message-ID: <20230622104001.2952219-1-matthieu.baerts@tessares.net>
+
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+
+commit ff8897b5189495b47895ca247b860a29dc04b36b upstream.
+
+Selftests are supposed to run on any kernels, including the old ones not
+supporting all MPTCP features.
+
+One of them is the support of the MP_FAIL / infinite mapping introduced
+by commit 1e39e5a32ad7 ("mptcp: infinite mapping sending") and the
+following ones.
+
+It is possible to look for one of the infinite mapping counters to know
+in advance if the this feature is available.
+
+Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
+Fixes: b6e074e171bc ("selftests: mptcp: add infinite map testcase")
+Cc: stable@vger.kernel.org
+Fixes: 2ba18161d407 ("selftests: mptcp: add MP_FAIL reset testcase")
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/net/mptcp/mptcp_join.sh |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -376,7 +376,7 @@ setup_fail_rules()
+ reset_with_fail()
+ {
+-      reset "${1}" || return 1
++      reset_check_counter "${1}" "MPTcpExtInfiniteMapTx" || return 1
+       shift
+       ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=1
diff --git a/queue-6.1/selftests-mptcp-join-skip-test-if-iptables-tc-cmds-fail.patch b/queue-6.1/selftests-mptcp-join-skip-test-if-iptables-tc-cmds-fail.patch
new file mode 100644 (file)
index 0000000..f78a515
--- /dev/null
@@ -0,0 +1,196 @@
+From stable-owner@vger.kernel.org Thu Jun 22 12:38:29 2023
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+Date: Thu, 22 Jun 2023 12:37:54 +0200
+Subject: selftests: mptcp: join: skip test if iptables/tc cmds fail
+To: stable@vger.kernel.org, gregkh@linuxfoundation.org
+Cc: Matthieu Baerts <matthieu.baerts@tessares.net>, Jakub Kicinski <kuba@kernel.org>
+Message-ID: <20230622103754.2949735-1-matthieu.baerts@tessares.net>
+
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+
+commit 4a0b866a3f7d3c22033f40e93e94befc6fe51bce upstream
+
+Selftests are supposed to run on any kernels, including the old ones not
+supporting all MPTCP features.
+
+Some tests are using IPTables and/or TC commands to force some
+behaviours. If one of these commands fails -- likely because some
+features are not available due to missing kernel config -- we should
+intercept the error and skip the tests requiring these features.
+
+Note that if we expect to have these features available and if
+SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES env var is set to 1, the tests
+will be marked as failed instead of skipped.
+
+This patch also replaces the 'exit 1' by 'return 1' not to stop the
+selftest in the middle without the conclusion if there is an issue with
+NF or TC.
+
+Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
+Fixes: 8d014eaa9254 ("selftests: mptcp: add ADD_ADDR timeout test case")
+Cc: stable@vger.kernel.org
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/net/mptcp/mptcp_join.sh |   88 +++++++++++++++---------
+ 1 file changed, 57 insertions(+), 31 deletions(-)
+
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -291,11 +291,15 @@ reset_with_add_addr_timeout()
+       fi
+       ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
+-      ip netns exec $ns2 $tables -A OUTPUT -p tcp \
+-              -m tcp --tcp-option 30 \
+-              -m bpf --bytecode \
+-              "$CBPF_MPTCP_SUBOPTION_ADD_ADDR" \
+-              -j DROP
++
++      if ! ip netns exec $ns2 $tables -A OUTPUT -p tcp \
++                      -m tcp --tcp-option 30 \
++                      -m bpf --bytecode \
++                      "$CBPF_MPTCP_SUBOPTION_ADD_ADDR" \
++                      -j DROP; then
++              mark_as_skipped "unable to set the 'add addr' rule"
++              return 1
++      fi
+ }
+ # $1: test name
+@@ -339,17 +343,12 @@ reset_with_allow_join_id0()
+ #     tc action pedit offset 162 out of bounds
+ #
+ # Netfilter is used to mark packets with enough data.
+-reset_with_fail()
++setup_fail_rules()
+ {
+-      reset "${1}" || return 1
+-
+-      ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=1
+-      ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=1
+-
+       check_invert=1
+       validate_checksum=1
+-      local i="$2"
+-      local ip="${3:-4}"
++      local i="$1"
++      local ip="${2:-4}"
+       local tables
+       tables="${iptables}"
+@@ -364,15 +363,51 @@ reset_with_fail()
+               -p tcp \
+               -m length --length 150:9999 \
+               -m statistic --mode nth --packet 1 --every 99999 \
+-              -j MARK --set-mark 42 || exit 1
++              -j MARK --set-mark 42 || return ${ksft_skip}
+-      tc -n $ns2 qdisc add dev ns2eth$i clsact || exit 1
++      tc -n $ns2 qdisc add dev ns2eth$i clsact || return ${ksft_skip}
+       tc -n $ns2 filter add dev ns2eth$i egress \
+               protocol ip prio 1000 \
+               handle 42 fw \
+               action pedit munge offset 148 u8 invert \
+               pipe csum tcp \
+-              index 100 || exit 1
++              index 100 || return ${ksft_skip}
++}
++
++reset_with_fail()
++{
++      reset "${1}" || return 1
++      shift
++
++      ip netns exec $ns1 sysctl -q net.mptcp.checksum_enabled=1
++      ip netns exec $ns2 sysctl -q net.mptcp.checksum_enabled=1
++
++      local rc=0
++      setup_fail_rules "${@}" || rc=$?
++
++      if [ ${rc} -eq ${ksft_skip} ]; then
++              mark_as_skipped "unable to set the 'fail' rules"
++              return 1
++      fi
++}
++
++reset_with_tcp_filter()
++{
++      reset "${1}" || return 1
++      shift
++
++      local ns="${!1}"
++      local src="${2}"
++      local target="${3}"
++
++      if ! ip netns exec "${ns}" ${iptables} \
++                      -A INPUT \
++                      -s "${src}" \
++                      -p tcp \
++                      -j "${target}"; then
++              mark_as_skipped "unable to set the filter rules"
++              return 1
++      fi
+ }
+ fail_test()
+@@ -732,15 +767,6 @@ pm_nl_check_endpoint()
+       fi
+ }
+-filter_tcp_from()
+-{
+-      local ns="${1}"
+-      local src="${2}"
+-      local target="${3}"
+-
+-      ip netns exec "${ns}" ${iptables} -A INPUT -s "${src}" -p tcp -j "${target}"
+-}
+-
+ do_transfer()
+ {
+       local listener_ns="$1"
+@@ -1949,23 +1975,23 @@ subflows_error_tests()
+       fi
+       # multiple subflows, with subflow creation error
+-      if reset "multi subflows, with failing subflow"; then
++      if reset_with_tcp_filter "multi subflows, with failing subflow" ns1 10.0.3.2 REJECT &&
++         continue_if mptcp_lib_kallsyms_has "mptcp_pm_subflow_check_next$"; then
+               pm_nl_set_limits $ns1 0 2
+               pm_nl_set_limits $ns2 0 2
+               pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
+               pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow
+-              filter_tcp_from $ns1 10.0.3.2 REJECT
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
+               chk_join_nr 1 1 1
+       fi
+       # multiple subflows, with subflow timeout on MPJ
+-      if reset "multi subflows, with subflow timeout"; then
++      if reset_with_tcp_filter "multi subflows, with subflow timeout" ns1 10.0.3.2 DROP &&
++         continue_if mptcp_lib_kallsyms_has "mptcp_pm_subflow_check_next$"; then
+               pm_nl_set_limits $ns1 0 2
+               pm_nl_set_limits $ns2 0 2
+               pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
+               pm_nl_add_endpoint $ns2 10.0.2.2 flags subflow
+-              filter_tcp_from $ns1 10.0.3.2 DROP
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow
+               chk_join_nr 1 1 1
+       fi
+@@ -1973,11 +1999,11 @@ subflows_error_tests()
+       # multiple subflows, check that the endpoint corresponding to
+       # closed subflow (due to reset) is not reused if additional
+       # subflows are added later
+-      if reset "multi subflows, fair usage on close"; then
++      if reset_with_tcp_filter "multi subflows, fair usage on close" ns1 10.0.3.2 REJECT &&
++         continue_if mptcp_lib_kallsyms_has "mptcp_pm_subflow_check_next$"; then
+               pm_nl_set_limits $ns1 0 1
+               pm_nl_set_limits $ns2 0 1
+               pm_nl_add_endpoint $ns2 10.0.3.2 flags subflow
+-              filter_tcp_from $ns1 10.0.3.2 REJECT
+               run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow &
+               # mpj subflow will be in TW after the reset
diff --git a/queue-6.1/selftests-mptcp-join-skip-userspace-pm-tests-if-not-supported.patch b/queue-6.1/selftests-mptcp-join-skip-userspace-pm-tests-if-not-supported.patch
new file mode 100644 (file)
index 0000000..e505c8f
--- /dev/null
@@ -0,0 +1,124 @@
+From stable-owner@vger.kernel.org Thu Jun 22 12:39:32 2023
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+Date: Thu, 22 Jun 2023 12:39:14 +0200
+Subject: selftests: mptcp: join: skip userspace PM tests if not supported
+To: stable@vger.kernel.org, gregkh@linuxfoundation.org
+Cc: Matthieu Baerts <matthieu.baerts@tessares.net>, Jakub Kicinski <kuba@kernel.org>
+Message-ID: <20230622103914.2951296-1-matthieu.baerts@tessares.net>
+
+From: Matthieu Baerts <matthieu.baerts@tessares.net>
+
+commit f2b492b04a167261e1c38eb76f78fb4294473a49 upstream.
+
+Selftests are supposed to run on any kernels, including the old ones not
+supporting all MPTCP features.
+
+One of them is the support of the userspace PM introduced by commit
+4638de5aefe5 ("mptcp: handle local addrs announced by userspace PMs")
+and the following ones.
+
+It is possible to look for the MPTCP pm_type's sysctl knob to know in
+advance if the userspace PM is available.
+
+Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368
+Fixes: 5ac1d2d63451 ("selftests: mptcp: Add tests for userspace PM type")
+Cc: stable@vger.kernel.org
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/testing/selftests/net/mptcp/mptcp_join.sh |   26 +++++++++++++++---------
+ 1 file changed, 17 insertions(+), 9 deletions(-)
+
+--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
+@@ -79,7 +79,7 @@ init_partial()
+               ip netns add $netns || exit $ksft_skip
+               ip -net $netns link set lo up
+               ip netns exec $netns sysctl -q net.mptcp.enabled=1
+-              ip netns exec $netns sysctl -q net.mptcp.pm_type=0
++              ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true
+               ip netns exec $netns sysctl -q net.ipv4.conf.all.rp_filter=0
+               ip netns exec $netns sysctl -q net.ipv4.conf.default.rp_filter=0
+               if [ $checksum -eq 1 ]; then
+@@ -3059,7 +3059,8 @@ fail_tests()
+ userspace_tests()
+ {
+       # userspace pm type prevents add_addr
+-      if reset "userspace pm type prevents add_addr"; then
++      if reset "userspace pm type prevents add_addr" &&
++         continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+               set_userspace_pm $ns1
+               pm_nl_set_limits $ns1 0 2
+               pm_nl_set_limits $ns2 0 2
+@@ -3070,7 +3071,8 @@ userspace_tests()
+       fi
+       # userspace pm type does not echo add_addr without daemon
+-      if reset "userspace pm no echo w/o daemon"; then
++      if reset "userspace pm no echo w/o daemon" &&
++         continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+               set_userspace_pm $ns2
+               pm_nl_set_limits $ns1 0 2
+               pm_nl_set_limits $ns2 0 2
+@@ -3081,7 +3083,8 @@ userspace_tests()
+       fi
+       # userspace pm type rejects join
+-      if reset "userspace pm type rejects join"; then
++      if reset "userspace pm type rejects join" &&
++         continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+               set_userspace_pm $ns1
+               pm_nl_set_limits $ns1 1 1
+               pm_nl_set_limits $ns2 1 1
+@@ -3091,7 +3094,8 @@ userspace_tests()
+       fi
+       # userspace pm type does not send join
+-      if reset "userspace pm type does not send join"; then
++      if reset "userspace pm type does not send join" &&
++         continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+               set_userspace_pm $ns2
+               pm_nl_set_limits $ns1 1 1
+               pm_nl_set_limits $ns2 1 1
+@@ -3101,7 +3105,8 @@ userspace_tests()
+       fi
+       # userspace pm type prevents mp_prio
+-      if reset "userspace pm type prevents mp_prio"; then
++      if reset "userspace pm type prevents mp_prio" &&
++         continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+               set_userspace_pm $ns1
+               pm_nl_set_limits $ns1 1 1
+               pm_nl_set_limits $ns2 1 1
+@@ -3112,7 +3117,8 @@ userspace_tests()
+       fi
+       # userspace pm type prevents rm_addr
+-      if reset "userspace pm type prevents rm_addr"; then
++      if reset "userspace pm type prevents rm_addr" &&
++         continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+               set_userspace_pm $ns1
+               set_userspace_pm $ns2
+               pm_nl_set_limits $ns1 0 1
+@@ -3124,7 +3130,8 @@ userspace_tests()
+       fi
+       # userspace pm add & remove address
+-      if reset "userspace pm add & remove address"; then
++      if reset "userspace pm add & remove address" &&
++         continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+               set_userspace_pm $ns1
+               pm_nl_set_limits $ns2 1 1
+               run_tests $ns1 $ns2 10.0.1.1 0 userspace_1 0 slow
+@@ -3134,7 +3141,8 @@ userspace_tests()
+       fi
+       # userspace pm create destroy subflow
+-      if reset "userspace pm create destroy subflow"; then
++      if reset "userspace pm create destroy subflow" &&
++         continue_if mptcp_lib_has_file '/proc/sys/net/mptcp/pm_type'; then
+               set_userspace_pm $ns2
+               pm_nl_set_limits $ns1 0 1
+               run_tests $ns1 $ns2 10.0.1.1 0 0 userspace_1 slow
index 2e1c53d28d6ce229ffa850e2b627ca5dfdc1431f..3d04b0b1df8bfd287c9b455b2a2eb553c7d40e85 100644 (file)
@@ -36,3 +36,7 @@ selftests-mptcp-join-skip-mpc-backups-tests-if-not-supported.patch
 selftests-mount_setattr-fix-redefine-struct-mount_attr-build-error.patch
 selftests-mptcp-diag-skip-listen-tests-if-not-supported.patch
 selftests-mptcp-sockopt-skip-tcp_inq-checks-if-not-supported.patch
+selftests-mptcp-join-skip-test-if-iptables-tc-cmds-fail.patch
+selftests-mptcp-join-skip-userspace-pm-tests-if-not-supported.patch
+selftests-mptcp-join-skip-fail-tests-if-not-supported.patch
+selftests-mptcp-join-fix-userspace-pm-add-remove-address.patch