From 68c889165613418dfcdbea971c496e39627f5145 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 4 Jul 2022 10:51:31 -0400 Subject: [PATCH] Fixes for 5.10 Signed-off-by: Sasha Levin --- ...add-missing-of_node_put-in-qoriq-cpu.patch | 37 +++ ...-t-call-platform_device_del-if-platf.patch | 71 +++++ ...ix-ipip6_tunnel_get_prl-return-value.patch | 67 +++++ ...s-mptcp-add-add_addr-ipv6-test-cases.patch | 119 ++++++++ ...mptcp-add-add_addr-timeout-test-case.patch | 239 +++++++++++++++ ...sts-mptcp-add-link-failure-test-case.patch | 272 +++++++++++++++++ ...selftests-mptcp-fix-diag-instability.patch | 117 ++++++++ ...cp-launch-mptcp_connect-with-timeout.patch | 281 ++++++++++++++++++ ...lftests-mptcp-more-stable-diag-tests.patch | 134 +++++++++ queue-5.10/series | 11 + queue-5.10/sit-use-min.patch | 39 +++ ...missing-nf_reset_ct-in-3whs-handling.patch | 75 +++++ 12 files changed, 1462 insertions(+) create mode 100644 queue-5.10/drivers-cpufreq-add-missing-of_node_put-in-qoriq-cpu.patch create mode 100644 queue-5.10/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch create mode 100644 queue-5.10/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch create mode 100644 queue-5.10/selftests-mptcp-add-add_addr-ipv6-test-cases.patch create mode 100644 queue-5.10/selftests-mptcp-add-add_addr-timeout-test-case.patch create mode 100644 queue-5.10/selftests-mptcp-add-link-failure-test-case.patch create mode 100644 queue-5.10/selftests-mptcp-fix-diag-instability.patch create mode 100644 queue-5.10/selftests-mptcp-launch-mptcp_connect-with-timeout.patch create mode 100644 queue-5.10/selftests-mptcp-more-stable-diag-tests.patch create mode 100644 queue-5.10/sit-use-min.patch create mode 100644 queue-5.10/tcp-add-a-missing-nf_reset_ct-in-3whs-handling.patch diff --git a/queue-5.10/drivers-cpufreq-add-missing-of_node_put-in-qoriq-cpu.patch b/queue-5.10/drivers-cpufreq-add-missing-of_node_put-in-qoriq-cpu.patch new file mode 100644 index 00000000000..cf5bdd8b4c1 --- /dev/null +++ b/queue-5.10/drivers-cpufreq-add-missing-of_node_put-in-qoriq-cpu.patch @@ -0,0 +1,37 @@ +From b6a7b4a85d77b08f283a78808444a0435eff991d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Jun 2022 17:48:07 +0800 +Subject: drivers: cpufreq: Add missing of_node_put() in qoriq-cpufreq.c + +From: Liang He + +[ Upstream commit 4ff5a9b6d95f3524bf6d27147df497eb21968300 ] + +In qoriq_cpufreq_probe(), of_find_matching_node() will return a +node pointer with refcount incremented. We should use of_node_put() +when it is not used anymore. + +Fixes: 157f527639da ("cpufreq: qoriq: convert to a platform driver") +[ Viresh: Fixed Author's name in commit log ] +Signed-off-by: Liang He +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/qoriq-cpufreq.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c +index 6b6b20da2bcf..573b417e1483 100644 +--- a/drivers/cpufreq/qoriq-cpufreq.c ++++ b/drivers/cpufreq/qoriq-cpufreq.c +@@ -275,6 +275,7 @@ static int qoriq_cpufreq_probe(struct platform_device *pdev) + + np = of_find_matching_node(NULL, qoriq_cpufreq_blacklist); + if (np) { ++ of_node_put(np); + dev_info(&pdev->dev, "Disabling due to erratum A-008083"); + return -ENODEV; + } +-- +2.35.1 + diff --git a/queue-5.10/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch b/queue-5.10/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch new file mode 100644 index 00000000000..aede0ffa61e --- /dev/null +++ b/queue-5.10/hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch @@ -0,0 +1,71 @@ +From 07ea5206936101956a5e8f7949298c1954bc2e92 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Jul 2022 15:41:53 +0800 +Subject: hwmon: (ibmaem) don't call platform_device_del() if + platform_device_add() fails + +From: Yang Yingliang + +[ Upstream commit d0e51022a025ca5350fafb8e413a6fe5d4baf833 ] + +If platform_device_add() fails, it no need to call platform_device_del(), split +platform_device_unregister() into platform_device_del/put(), so platform_device_put() +can be called separately. + +Fixes: 8808a793f052 ("ibmaem: new driver for power/energy/temp meters in IBM System X hardware") +Reported-by: Hulk Robot +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20220701074153.4021556-1-yangyingliang@huawei.com +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/ibmaem.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c +index a4ec85207782..2e6d6a5cffa1 100644 +--- a/drivers/hwmon/ibmaem.c ++++ b/drivers/hwmon/ibmaem.c +@@ -550,7 +550,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle) + + res = platform_device_add(data->pdev); + if (res) +- goto ipmi_err; ++ goto dev_add_err; + + platform_set_drvdata(data->pdev, data); + +@@ -598,7 +598,9 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle) + ipmi_destroy_user(data->ipmi.user); + ipmi_err: + platform_set_drvdata(data->pdev, NULL); +- platform_device_unregister(data->pdev); ++ platform_device_del(data->pdev); ++dev_add_err: ++ platform_device_put(data->pdev); + dev_err: + ida_simple_remove(&aem_ida, data->id); + id_err: +@@ -690,7 +692,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe, + + res = platform_device_add(data->pdev); + if (res) +- goto ipmi_err; ++ goto dev_add_err; + + platform_set_drvdata(data->pdev, data); + +@@ -738,7 +740,9 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe, + ipmi_destroy_user(data->ipmi.user); + ipmi_err: + platform_set_drvdata(data->pdev, NULL); +- platform_device_unregister(data->pdev); ++ platform_device_del(data->pdev); ++dev_add_err: ++ platform_device_put(data->pdev); + dev_err: + ida_simple_remove(&aem_ida, data->id); + id_err: +-- +2.35.1 + diff --git a/queue-5.10/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch b/queue-5.10/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch new file mode 100644 index 00000000000..029541dbba3 --- /dev/null +++ b/queue-5.10/ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch @@ -0,0 +1,67 @@ +From 010d090eaaedf15f22d5ef6b1ddcda30d7dea3bd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Jun 2022 11:50:30 +0800 +Subject: ipv6/sit: fix ipip6_tunnel_get_prl return value + +From: katrinzhou + +[ Upstream commit adabdd8f6acabc0c3fdbba2e7f5a2edd9c5ef22d ] + +When kcalloc fails, ipip6_tunnel_get_prl() should return -ENOMEM. +Move the position of label "out" to return correctly. + +Addresses-Coverity: ("Unused value") +Fixes: 300aaeeaab5f ("[IPV6] SIT: Add SIOCGETPRL ioctl to get/dump PRL.") +Signed-off-by: katrinzhou +Reviewed-by: Eric Dumazet +Reviewed-by: David Ahern +Link: https://lore.kernel.org/r/20220628035030.1039171-1-zys.zljxml@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv6/sit.c | 8 +++----- + 1 file changed, 3 insertions(+), 5 deletions(-) + +diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c +index 0be82586ce32..3c92e8cacbba 100644 +--- a/net/ipv6/sit.c ++++ b/net/ipv6/sit.c +@@ -321,8 +321,6 @@ static int ipip6_tunnel_get_prl(struct net_device *dev, struct ifreq *ifr) + kcalloc(cmax, sizeof(*kp), GFP_KERNEL | __GFP_NOWARN) : + NULL; + +- rcu_read_lock(); +- + ca = min(t->prl_count, cmax); + + if (!kp) { +@@ -338,7 +336,7 @@ static int ipip6_tunnel_get_prl(struct net_device *dev, struct ifreq *ifr) + } + } + +- c = 0; ++ rcu_read_lock(); + for_each_prl_rcu(t->prl) { + if (c >= cmax) + break; +@@ -350,7 +348,7 @@ static int ipip6_tunnel_get_prl(struct net_device *dev, struct ifreq *ifr) + if (kprl.addr != htonl(INADDR_ANY)) + break; + } +-out: ++ + rcu_read_unlock(); + + len = sizeof(*kp) * c; +@@ -359,7 +357,7 @@ static int ipip6_tunnel_get_prl(struct net_device *dev, struct ifreq *ifr) + ret = -EFAULT; + + kfree(kp); +- ++out: + return ret; + } + +-- +2.35.1 + diff --git a/queue-5.10/selftests-mptcp-add-add_addr-ipv6-test-cases.patch b/queue-5.10/selftests-mptcp-add-add_addr-ipv6-test-cases.patch new file mode 100644 index 00000000000..3f568bb6b5e --- /dev/null +++ b/queue-5.10/selftests-mptcp-add-add_addr-ipv6-test-cases.patch @@ -0,0 +1,119 @@ +From 054a558df0fa9869b37cc4f5b05dafa5d5d6dd0e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 19 Nov 2020 11:46:01 -0800 +Subject: selftests: mptcp: add ADD_ADDR IPv6 test cases + +From: Geliang Tang + +[ Upstream commit 523514ed0a998fda389b9b6f00d0f2054ba30d25 ] + +This patch added IPv6 support for do_transfer, and the test cases for +ADD_ADDR IPv6. + +Acked-by: Paolo Abeni +Signed-off-by: Geliang Tang +Signed-off-by: Mat Martineau +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + .../testing/selftests/net/mptcp/mptcp_join.sh | 70 ++++++++++++++++++- + 1 file changed, 69 insertions(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh +index f841ed8186c1..0eae628d1ffd 100755 +--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh ++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh +@@ -195,6 +195,12 @@ link_failure() + ip -net "$ns" link set "$veth" down + } + ++# $1: IP address ++is_v6() ++{ ++ [ -z "${1##*:*}" ] ++} ++ + do_transfer() + { + listener_ns="$1" +@@ -236,7 +242,15 @@ do_transfer() + mptcp_connect="./mptcp_connect -r" + fi + +- ip netns exec ${listener_ns} $mptcp_connect -t $timeout -l -p $port -s ${srv_proto} 0.0.0.0 < "$sin" > "$sout" & ++ local local_addr ++ if is_v6 "${connect_addr}"; then ++ local_addr="::" ++ else ++ local_addr="0.0.0.0" ++ fi ++ ++ ip netns exec ${listener_ns} $mptcp_connect -t $timeout -l -p $port \ ++ -s ${srv_proto} ${local_addr} < "$sin" > "$sout" & + spid=$! + + sleep 1 +@@ -649,6 +663,60 @@ chk_join_nr "remove subflows and signal" 3 3 3 + chk_add_nr 1 1 + chk_rm_nr 2 2 + ++# subflow IPv6 ++reset ++ip netns exec $ns1 ./pm_nl_ctl limits 0 1 ++ip netns exec $ns2 ./pm_nl_ctl limits 0 1 ++ip netns exec $ns2 ./pm_nl_ctl add dead:beef:3::2 flags subflow ++run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow ++chk_join_nr "single subflow IPv6" 1 1 1 ++ ++# add_address, unused IPv6 ++reset ++ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal ++run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow ++chk_join_nr "unused signal address IPv6" 0 0 0 ++chk_add_nr 1 1 ++ ++# signal address IPv6 ++reset ++ip netns exec $ns1 ./pm_nl_ctl limits 0 1 ++ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal ++ip netns exec $ns2 ./pm_nl_ctl limits 1 1 ++run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow ++chk_join_nr "single address IPv6" 1 1 1 ++chk_add_nr 1 1 ++ ++# add_addr timeout IPv6 ++reset_with_add_addr_timeout 6 ++ip netns exec $ns1 ./pm_nl_ctl limits 0 1 ++ip netns exec $ns2 ./pm_nl_ctl limits 1 1 ++ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal ++run_tests $ns1 $ns2 dead:beef:1::1 0 0 0 slow ++chk_join_nr "signal address, ADD_ADDR6 timeout" 1 1 1 ++chk_add_nr 4 0 ++ ++# single address IPv6, remove ++reset ++ip netns exec $ns1 ./pm_nl_ctl limits 0 1 ++ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal ++ip netns exec $ns2 ./pm_nl_ctl limits 1 1 ++run_tests $ns1 $ns2 dead:beef:1::1 0 1 0 slow ++chk_join_nr "remove single address IPv6" 1 1 1 ++chk_add_nr 1 1 ++chk_rm_nr 0 0 ++ ++# subflow and signal IPv6, remove ++reset ++ip netns exec $ns1 ./pm_nl_ctl limits 0 2 ++ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal ++ip netns exec $ns2 ./pm_nl_ctl limits 1 2 ++ip netns exec $ns2 ./pm_nl_ctl add dead:beef:3::2 flags subflow ++run_tests $ns1 $ns2 dead:beef:1::1 0 1 1 slow ++chk_join_nr "remove subflow and signal IPv6" 2 2 2 ++chk_add_nr 1 1 ++chk_rm_nr 1 1 ++ + # single subflow, syncookies + reset_with_cookies + ip netns exec $ns1 ./pm_nl_ctl limits 0 1 +-- +2.35.1 + diff --git a/queue-5.10/selftests-mptcp-add-add_addr-timeout-test-case.patch b/queue-5.10/selftests-mptcp-add-add_addr-timeout-test-case.patch new file mode 100644 index 00000000000..274d57efdaf --- /dev/null +++ b/queue-5.10/selftests-mptcp-add-add_addr-timeout-test-case.patch @@ -0,0 +1,239 @@ +From 825473bcfd4099d00437859475e8141a835f1bc8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 3 Nov 2020 11:05:09 -0800 +Subject: selftests: mptcp: add ADD_ADDR timeout test case + +From: Geliang Tang + +[ Upstream commit 8d014eaa9254a9b8e0841df40dd36782b451579a ] + +This patch added the test case for retransmitting ADD_ADDR when timeout +occurs. It set NS1's add_addr_timeout to 1 second, and drop NS2's ADD_ADDR +echo packets. + +Here we need to slow down the transfer process of all data to let the +ADD_ADDR suboptions can be retransmitted three times. So we added a new +parameter "speed" for do_transfer, it can be set with fast or slow. + +We also added three new optional parameters for run_tests, and dropped +run_remove_tests function. + +Since we added the netfilter rules in this test case, we need to update +the "config" file. + +Suggested-by: Matthieu Baerts +Suggested-by: Paolo Abeni +Acked-by: Paolo Abeni +Reviewed-by: Matthieu Baerts +Signed-off-by: Geliang Tang +Signed-off-by: Mat Martineau +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/mptcp/config | 10 ++ + .../testing/selftests/net/mptcp/mptcp_join.sh | 94 ++++++++++++++----- + 2 files changed, 80 insertions(+), 24 deletions(-) + +diff --git a/tools/testing/selftests/net/mptcp/config b/tools/testing/selftests/net/mptcp/config +index 741a1c4f4ae8..0faaccd21447 100644 +--- a/tools/testing/selftests/net/mptcp/config ++++ b/tools/testing/selftests/net/mptcp/config +@@ -5,3 +5,13 @@ CONFIG_INET_DIAG=m + CONFIG_INET_MPTCP_DIAG=m + CONFIG_VETH=y + CONFIG_NET_SCH_NETEM=m ++CONFIG_NETFILTER=y ++CONFIG_NETFILTER_ADVANCED=y ++CONFIG_NETFILTER_NETLINK=m ++CONFIG_NF_TABLES=m ++CONFIG_NFT_COUNTER=m ++CONFIG_NFT_COMPAT=m ++CONFIG_NETFILTER_XTABLES=m ++CONFIG_NETFILTER_XT_MATCH_BPF=m ++CONFIG_NF_TABLES_IPV4=y ++CONFIG_NF_TABLES_IPV6=y +diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh +index 08f53d86dedc..0d93b243695f 100755 +--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh ++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh +@@ -13,6 +13,24 @@ capture=0 + + TEST_COUNT=0 + ++# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) || ++# (ip6 && (ip6[74] & 0xf0) == 0x30)'" ++CBPF_MPTCP_SUBOPTION_ADD_ADDR="14, ++ 48 0 0 0, ++ 84 0 0 240, ++ 21 0 3 64, ++ 48 0 0 54, ++ 84 0 0 240, ++ 21 6 7 48, ++ 48 0 0 0, ++ 84 0 0 240, ++ 21 0 4 96, ++ 48 0 0 74, ++ 84 0 0 240, ++ 21 0 1 48, ++ 6 0 0 65535, ++ 6 0 0 0" ++ + init() + { + capout=$(mktemp) +@@ -82,6 +100,26 @@ reset_with_cookies() + done + } + ++reset_with_add_addr_timeout() ++{ ++ local ip="${1:-4}" ++ local tables ++ ++ tables="iptables" ++ if [ $ip -eq 6 ]; then ++ tables="ip6tables" ++ fi ++ ++ reset ++ ++ 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 ++} ++ + for arg in "$@"; do + if [ "$arg" = "-c" ]; then + capture=1 +@@ -94,6 +132,17 @@ if [ $? -ne 0 ];then + exit $ksft_skip + fi + ++iptables -V > /dev/null 2>&1 ++if [ $? -ne 0 ];then ++ echo "SKIP: Could not run all tests without iptables tool" ++ exit $ksft_skip ++fi ++ ++ip6tables -V > /dev/null 2>&1 ++if [ $? -ne 0 ];then ++ echo "SKIP: Could not run all tests without ip6tables tool" ++ exit $ksft_skip ++fi + + check_transfer() + { +@@ -135,6 +184,7 @@ do_transfer() + connect_addr="$5" + rm_nr_ns1="$6" + rm_nr_ns2="$7" ++ speed="$8" + + port=$((10000+$TEST_COUNT)) + TEST_COUNT=$((TEST_COUNT+1)) +@@ -159,7 +209,7 @@ do_transfer() + sleep 1 + fi + +- if [[ $rm_nr_ns1 -eq 0 && $rm_nr_ns2 -eq 0 ]]; then ++ if [ $speed = "fast" ]; then + mptcp_connect="./mptcp_connect -j" + else + mptcp_connect="./mptcp_connect -r" +@@ -250,26 +300,13 @@ run_tests() + listener_ns="$1" + connector_ns="$2" + connect_addr="$3" ++ rm_nr_ns1="${4:-0}" ++ rm_nr_ns2="${5:-0}" ++ speed="${6:-fast}" + lret=0 + +- do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} 0 0 +- lret=$? +- if [ $lret -ne 0 ]; then +- ret=$lret +- return +- fi +-} +- +-run_remove_tests() +-{ +- listener_ns="$1" +- connector_ns="$2" +- connect_addr="$3" +- rm_nr_ns1="$4" +- rm_nr_ns2="$5" +- lret=0 +- +- do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} ${rm_nr_ns1} ${rm_nr_ns2} ++ do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \ ++ ${rm_nr_ns1} ${rm_nr_ns2} ${speed} + lret=$? + if [ $lret -ne 0 ]; then + ret=$lret +@@ -491,12 +528,21 @@ run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr "multiple subflows and signal" 3 3 3 + chk_add_nr 1 1 + ++# add_addr timeout ++reset_with_add_addr_timeout ++ip netns exec $ns1 ./pm_nl_ctl limits 0 1 ++ip netns exec $ns2 ./pm_nl_ctl limits 1 1 ++ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal ++run_tests $ns1 $ns2 10.0.1.1 0 0 slow ++chk_join_nr "signal address, ADD_ADDR timeout" 1 1 1 ++chk_add_nr 4 0 ++ + # single subflow, remove + reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 1 + ip netns exec $ns2 ./pm_nl_ctl limits 0 1 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow +-run_remove_tests $ns1 $ns2 10.0.1.1 0 1 ++run_tests $ns1 $ns2 10.0.1.1 0 1 slow + chk_join_nr "remove single subflow" 1 1 1 + chk_rm_nr 1 1 + +@@ -506,7 +552,7 @@ ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow +-run_remove_tests $ns1 $ns2 10.0.1.1 0 2 ++run_tests $ns1 $ns2 10.0.1.1 0 2 slow + chk_join_nr "remove multiple subflows" 2 2 2 + chk_rm_nr 2 2 + +@@ -515,7 +561,7 @@ reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 1 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + ip netns exec $ns2 ./pm_nl_ctl limits 1 1 +-run_remove_tests $ns1 $ns2 10.0.1.1 1 0 ++run_tests $ns1 $ns2 10.0.1.1 1 0 slow + chk_join_nr "remove single address" 1 1 1 + chk_add_nr 1 1 + chk_rm_nr 0 0 +@@ -526,7 +572,7 @@ ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + ip netns exec $ns2 ./pm_nl_ctl limits 1 2 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow +-run_remove_tests $ns1 $ns2 10.0.1.1 1 1 ++run_tests $ns1 $ns2 10.0.1.1 1 1 slow + chk_join_nr "remove subflow and signal" 2 2 2 + chk_add_nr 1 1 + chk_rm_nr 1 1 +@@ -538,7 +584,7 @@ ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + ip netns exec $ns2 ./pm_nl_ctl limits 1 3 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow + ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow +-run_remove_tests $ns1 $ns2 10.0.1.1 1 2 ++run_tests $ns1 $ns2 10.0.1.1 1 2 slow + chk_join_nr "remove subflows and signal" 3 3 3 + chk_add_nr 1 1 + chk_rm_nr 2 2 +-- +2.35.1 + diff --git a/queue-5.10/selftests-mptcp-add-link-failure-test-case.patch b/queue-5.10/selftests-mptcp-add-link-failure-test-case.patch new file mode 100644 index 00000000000..aa923c02a01 --- /dev/null +++ b/queue-5.10/selftests-mptcp-add-link-failure-test-case.patch @@ -0,0 +1,272 @@ +From b9318292fae9121f77c7cae66b174eec89273b9a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 19 Nov 2020 11:45:57 -0800 +Subject: selftests: mptcp: add link failure test case + +From: Florian Westphal + +[ Upstream commit 8b819a84d4b12c4a91cc9f91ad69ca09c3e0606d ] + +Add a test case where a link fails with multiple subflows. +The expectation is that MPTCP will transmit any data that +could not be delivered via the failed link on another subflow. + +Co-developed-by: Geliang Tang +Signed-off-by: Geliang Tang +Signed-off-by: Florian Westphal +Signed-off-by: Mat Martineau +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + .../testing/selftests/net/mptcp/mptcp_join.sh | 104 ++++++++++++++---- + 1 file changed, 82 insertions(+), 22 deletions(-) + +diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh +index 0d93b243695f..f841ed8186c1 100755 +--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh ++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh +@@ -5,6 +5,7 @@ ret=0 + sin="" + sout="" + cin="" ++cinsent="" + cout="" + ksft_skip=4 + timeout=30 +@@ -81,7 +82,7 @@ cleanup_partial() + cleanup() + { + rm -f "$cin" "$cout" +- rm -f "$sin" "$sout" ++ rm -f "$sin" "$sout" "$cinsent" + cleanup_partial + } + +@@ -144,6 +145,13 @@ if [ $? -ne 0 ];then + exit $ksft_skip + fi + ++print_file_err() ++{ ++ ls -l "$1" 1>&2 ++ echo "Trailing bytes are: " ++ tail -c 27 "$1" ++} ++ + check_transfer() + { + in=$1 +@@ -155,6 +163,7 @@ check_transfer() + echo "[ FAIL ] $what does not match (in, out):" + print_file_err "$in" + print_file_err "$out" ++ ret=1 + + return 1 + fi +@@ -175,6 +184,17 @@ do_ping() + fi + } + ++link_failure() ++{ ++ ns="$1" ++ ++ l=$((RANDOM%4)) ++ l=$((l+1)) ++ ++ veth="ns1eth$l" ++ ip -net "$ns" link set "$veth" down ++} ++ + do_transfer() + { + listener_ns="$1" +@@ -182,9 +202,10 @@ do_transfer() + cl_proto="$3" + srv_proto="$4" + connect_addr="$5" +- rm_nr_ns1="$6" +- rm_nr_ns2="$7" +- speed="$8" ++ test_link_fail="$6" ++ rm_nr_ns1="$7" ++ rm_nr_ns2="$8" ++ speed="$9" + + port=$((10000+$TEST_COUNT)) + TEST_COUNT=$((TEST_COUNT+1)) +@@ -220,7 +241,12 @@ do_transfer() + + sleep 1 + +- ip netns exec ${connector_ns} $mptcp_connect -t $timeout -p $port -s ${cl_proto} $connect_addr < "$cin" > "$cout" & ++ if [ "$test_link_fail" -eq 0 ];then ++ ip netns exec ${connector_ns} $mptcp_connect -t $timeout -p $port -s ${cl_proto} $connect_addr < "$cin" > "$cout" & ++ else ++ ( cat "$cin" ; sleep 2; link_failure $listener_ns ; cat "$cin" ) | tee "$cinsent" | \ ++ ip netns exec ${connector_ns} $mptcp_connect -t $timeout -p $port -s ${cl_proto} $connect_addr > "$cout" & ++ fi + cpid=$! + + if [ $rm_nr_ns1 -gt 0 ]; then +@@ -265,12 +291,17 @@ do_transfer() + ip netns exec ${connector_ns} ss -nita 1>&2 -o "dport = :$port" + + cat "$capout" ++ ret=1 + return 1 + fi + + check_transfer $sin $cout "file received by client" + retc=$? +- check_transfer $cin $sout "file received by server" ++ if [ "$test_link_fail" -eq 0 ];then ++ check_transfer $cin $sout "file received by server" ++ else ++ check_transfer $cinsent $sout "file received by server" ++ fi + rets=$? + + if [ $retc -eq 0 ] && [ $rets -eq 0 ];then +@@ -286,13 +317,12 @@ make_file() + { + name=$1 + who=$2 ++ size=$3 + +- SIZE=1 +- +- dd if=/dev/urandom of="$name" bs=1024 count=$SIZE 2> /dev/null ++ dd if=/dev/urandom of="$name" bs=1024 count=$size 2> /dev/null + echo -e "\nMPTCP_TEST_FILE_END_MARKER" >> "$name" + +- echo "Created $name (size $SIZE KB) containing data sent by $who" ++ echo "Created $name (size $size KB) containing data sent by $who" + } + + run_tests() +@@ -300,14 +330,32 @@ run_tests() + listener_ns="$1" + connector_ns="$2" + connect_addr="$3" +- rm_nr_ns1="${4:-0}" +- rm_nr_ns2="${5:-0}" +- speed="${6:-fast}" ++ test_linkfail="${4:-0}" ++ rm_nr_ns1="${5:-0}" ++ rm_nr_ns2="${6:-0}" ++ speed="${7:-fast}" + lret=0 ++ oldin="" ++ ++ if [ "$test_linkfail" -eq 1 ];then ++ size=$((RANDOM%1024)) ++ size=$((size+1)) ++ size=$((size*128)) ++ ++ oldin=$(mktemp) ++ cp "$cin" "$oldin" ++ make_file "$cin" "client" $size ++ fi + + do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \ +- ${rm_nr_ns1} ${rm_nr_ns2} ${speed} ++ ${test_linkfail} ${rm_nr_ns1} ${rm_nr_ns2} ${speed} + lret=$? ++ ++ if [ "$test_linkfail" -eq 1 ];then ++ cp "$oldin" "$cin" ++ rm -f "$oldin" ++ fi ++ + if [ $lret -ne 0 ]; then + ret=$lret + return +@@ -440,10 +488,11 @@ chk_rm_nr() + sin=$(mktemp) + sout=$(mktemp) + cin=$(mktemp) ++cinsent=$(mktemp) + cout=$(mktemp) + init +-make_file "$cin" "client" +-make_file "$sin" "server" ++make_file "$cin" "client" 1 ++make_file "$sin" "server" 1 + trap cleanup EXIT + + run_tests $ns1 $ns2 10.0.1.1 +@@ -528,12 +577,23 @@ run_tests $ns1 $ns2 10.0.1.1 + chk_join_nr "multiple subflows and signal" 3 3 3 + chk_add_nr 1 1 + ++# accept and use add_addr with additional subflows and link loss ++reset ++ip netns exec $ns1 ./pm_nl_ctl limits 0 3 ++ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal ++ip netns exec $ns2 ./pm_nl_ctl limits 1 3 ++ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow ++ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow ++run_tests $ns1 $ns2 10.0.1.1 1 ++chk_join_nr "multiple flows, signal, link failure" 3 3 3 ++chk_add_nr 1 1 ++ + # add_addr timeout + reset_with_add_addr_timeout + ip netns exec $ns1 ./pm_nl_ctl limits 0 1 + ip netns exec $ns2 ./pm_nl_ctl limits 1 1 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal +-run_tests $ns1 $ns2 10.0.1.1 0 0 slow ++run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow + chk_join_nr "signal address, ADD_ADDR timeout" 1 1 1 + chk_add_nr 4 0 + +@@ -542,7 +602,7 @@ reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 1 + ip netns exec $ns2 ./pm_nl_ctl limits 0 1 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow +-run_tests $ns1 $ns2 10.0.1.1 0 1 slow ++run_tests $ns1 $ns2 10.0.1.1 0 0 1 slow + chk_join_nr "remove single subflow" 1 1 1 + chk_rm_nr 1 1 + +@@ -552,7 +612,7 @@ ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl limits 0 2 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow +-run_tests $ns1 $ns2 10.0.1.1 0 2 slow ++run_tests $ns1 $ns2 10.0.1.1 0 0 2 slow + chk_join_nr "remove multiple subflows" 2 2 2 + chk_rm_nr 2 2 + +@@ -561,7 +621,7 @@ reset + ip netns exec $ns1 ./pm_nl_ctl limits 0 1 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + ip netns exec $ns2 ./pm_nl_ctl limits 1 1 +-run_tests $ns1 $ns2 10.0.1.1 1 0 slow ++run_tests $ns1 $ns2 10.0.1.1 0 1 0 slow + chk_join_nr "remove single address" 1 1 1 + chk_add_nr 1 1 + chk_rm_nr 0 0 +@@ -572,7 +632,7 @@ ip netns exec $ns1 ./pm_nl_ctl limits 0 2 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + ip netns exec $ns2 ./pm_nl_ctl limits 1 2 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow +-run_tests $ns1 $ns2 10.0.1.1 1 1 slow ++run_tests $ns1 $ns2 10.0.1.1 0 1 1 slow + chk_join_nr "remove subflow and signal" 2 2 2 + chk_add_nr 1 1 + chk_rm_nr 1 1 +@@ -584,7 +644,7 @@ ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal + ip netns exec $ns2 ./pm_nl_ctl limits 1 3 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow + ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow +-run_tests $ns1 $ns2 10.0.1.1 1 2 slow ++run_tests $ns1 $ns2 10.0.1.1 0 1 2 slow + chk_join_nr "remove subflows and signal" 3 3 3 + chk_add_nr 1 1 + chk_rm_nr 2 2 +-- +2.35.1 + diff --git a/queue-5.10/selftests-mptcp-fix-diag-instability.patch b/queue-5.10/selftests-mptcp-fix-diag-instability.patch new file mode 100644 index 00000000000..795d77f726e --- /dev/null +++ b/queue-5.10/selftests-mptcp-fix-diag-instability.patch @@ -0,0 +1,117 @@ +From d181f6e27b7f5f0186de786a1876fdd8be35e0fb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 18 Feb 2022 13:35:38 -0800 +Subject: selftests: mptcp: fix diag instability + +From: Paolo Abeni + +[ Upstream commit 0cd33c5ffec12bd77a1c02db2469fac08f840939 ] + +Instead of waiting for an arbitrary amount of time for the MPTCP +MP_CAPABLE handshake to complete, explicitly wait for the relevant +socket to enter into the established status. + +Additionally let the data transfer application use the slowest +transfer mode available (-r), to cope with very slow host, or +high jitter caused by hosting VMs. + +Fixes: df62f2ec3df6 ("selftests/mptcp: add diag interface tests") +Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/258 +Reported-and-tested-by: Matthieu Baerts +Signed-off-by: Paolo Abeni +Signed-off-by: Mat Martineau +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/mptcp/diag.sh | 44 +++++++++++++++++++---- + 1 file changed, 37 insertions(+), 7 deletions(-) + +diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh +index 2674ba20d524..ff821025d309 100755 +--- a/tools/testing/selftests/net/mptcp/diag.sh ++++ b/tools/testing/selftests/net/mptcp/diag.sh +@@ -71,6 +71,36 @@ chk_msk_remote_key_nr() + __chk_nr "grep -c remote_key" $* + } + ++# $1: ns, $2: port ++wait_local_port_listen() ++{ ++ local listener_ns="${1}" ++ local port="${2}" ++ ++ local port_hex i ++ ++ port_hex="$(printf "%04X" "${port}")" ++ for i in $(seq 10); do ++ ip netns exec "${listener_ns}" cat /proc/net/tcp | \ ++ awk "BEGIN {rc=1} {if (\$2 ~ /:${port_hex}\$/ && \$4 ~ /0A/) {rc=0; exit}} END {exit rc}" && ++ break ++ sleep 0.1 ++ done ++} ++ ++wait_connected() ++{ ++ local listener_ns="${1}" ++ local port="${2}" ++ ++ local port_hex i ++ ++ port_hex="$(printf "%04X" "${port}")" ++ for i in $(seq 10); do ++ ip netns exec ${listener_ns} grep -q " 0100007F:${port_hex} " /proc/net/tcp && break ++ sleep 0.1 ++ done ++} + + trap cleanup EXIT + ip netns add $ns +@@ -81,15 +111,15 @@ echo "a" | \ + ip netns exec $ns \ + ./mptcp_connect -p 10000 -l -t ${timeout_poll} \ + 0.0.0.0 >/dev/null & +-sleep 0.1 ++wait_local_port_listen $ns 10000 + chk_msk_nr 0 "no msk on netns creation" + + echo "b" | \ + timeout ${timeout_test} \ + ip netns exec $ns \ +- ./mptcp_connect -p 10000 -j -t ${timeout_poll} \ ++ ./mptcp_connect -p 10000 -r 0 -t ${timeout_poll} \ + 127.0.0.1 >/dev/null & +-sleep 0.1 ++wait_connected $ns 10000 + chk_msk_nr 2 "after MPC handshake " + chk_msk_remote_key_nr 2 "....chk remote_key" + chk_msk_fallback_nr 0 "....chk no fallback" +@@ -101,13 +131,13 @@ echo "a" | \ + ip netns exec $ns \ + ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} \ + 0.0.0.0 >/dev/null & +-sleep 0.1 ++wait_local_port_listen $ns 10001 + echo "b" | \ + timeout ${timeout_test} \ + ip netns exec $ns \ +- ./mptcp_connect -p 10001 -j -t ${timeout_poll} \ ++ ./mptcp_connect -p 10001 -r 0 -t ${timeout_poll} \ + 127.0.0.1 >/dev/null & +-sleep 0.1 ++wait_connected $ns 10001 + chk_msk_fallback_nr 1 "check fallback" + flush_pids + +@@ -119,7 +149,7 @@ for I in `seq 1 $NR_CLIENTS`; do + ./mptcp_connect -p $((I+10001)) -l -w 10 \ + -t ${timeout_poll} 0.0.0.0 >/dev/null & + done +-sleep 0.1 ++wait_local_port_listen $ns $((NR_CLIENTS + 10001)) + + for I in `seq 1 $NR_CLIENTS`; do + echo "b" | \ +-- +2.35.1 + diff --git a/queue-5.10/selftests-mptcp-launch-mptcp_connect-with-timeout.patch b/queue-5.10/selftests-mptcp-launch-mptcp_connect-with-timeout.patch new file mode 100644 index 00000000000..5b17908504b --- /dev/null +++ b/queue-5.10/selftests-mptcp-launch-mptcp_connect-with-timeout.patch @@ -0,0 +1,281 @@ +From b23c8fba255147839099d099df957bc42e984191 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 1 Apr 2021 16:19:45 -0700 +Subject: selftests: mptcp: launch mptcp_connect with timeout + +From: Matthieu Baerts + +[ Upstream commit 5888a61cb4e00695075bbacfd86f3fa73af00413 ] + +'mptcp_connect' already has a timeout for poll() but in some cases, it +is not enough. + +With "timeout" tool, we will force the command to fail if it doesn't +finish on time. Thanks to that, the script will continue and display +details about the current state before marking the test as failed. +Displaying this state is very important to be able to understand the +issue. Best to have our CI reporting the issue than just "the test +hanged". + +Note that in mptcp_connect.sh, we were using a long timeout to validate +the fact we cannot create a socket if a sysctl is set. We don't need +this timeout. + +In diag.sh, we want to send signals to mptcp_connect instances that have +been started in the netns. But we cannot send this signal to 'timeout' +otherwise that will stop the timeout and messages telling us SIGUSR1 has +been received will be printed. Instead of trying to find the right PID +and storing them in an array, we can simply use the output of +'ip netns pids' which is all the PIDs we want to send signal to. + +Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/160 +Signed-off-by: Matthieu Baerts +Signed-off-by: Mat Martineau +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/mptcp/diag.sh | 55 ++++++++++++------- + .../selftests/net/mptcp/mptcp_connect.sh | 15 +++-- + .../testing/selftests/net/mptcp/mptcp_join.sh | 22 ++++++-- + .../selftests/net/mptcp/simult_flows.sh | 13 ++++- + 4 files changed, 72 insertions(+), 33 deletions(-) + +diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh +index 39edce4f541c..2674ba20d524 100755 +--- a/tools/testing/selftests/net/mptcp/diag.sh ++++ b/tools/testing/selftests/net/mptcp/diag.sh +@@ -5,8 +5,9 @@ rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) + ns="ns1-$rndh" + ksft_skip=4 + test_cnt=1 ++timeout_poll=100 ++timeout_test=$((timeout_poll * 2 + 1)) + ret=0 +-pids=() + + flush_pids() + { +@@ -14,18 +15,14 @@ flush_pids() + # give it some time + sleep 1.1 + +- for pid in ${pids[@]}; do +- [ -d /proc/$pid ] && kill -SIGUSR1 $pid >/dev/null 2>&1 +- done +- pids=() ++ ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGUSR1 &>/dev/null + } + + cleanup() + { ++ ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGKILL &>/dev/null ++ + ip netns del $ns +- for pid in ${pids[@]}; do +- [ -d /proc/$pid ] && kill -9 $pid >/dev/null 2>&1 +- done + } + + ip -Version > /dev/null 2>&1 +@@ -79,39 +76,57 @@ trap cleanup EXIT + ip netns add $ns + ip -n $ns link set dev lo up + +-echo "a" | ip netns exec $ns ./mptcp_connect -p 10000 -l 0.0.0.0 -t 100 >/dev/null & ++echo "a" | \ ++ timeout ${timeout_test} \ ++ ip netns exec $ns \ ++ ./mptcp_connect -p 10000 -l -t ${timeout_poll} \ ++ 0.0.0.0 >/dev/null & + sleep 0.1 +-pids[0]=$! + chk_msk_nr 0 "no msk on netns creation" + +-echo "b" | ip netns exec $ns ./mptcp_connect -p 10000 127.0.0.1 -j -t 100 >/dev/null & ++echo "b" | \ ++ timeout ${timeout_test} \ ++ ip netns exec $ns \ ++ ./mptcp_connect -p 10000 -j -t ${timeout_poll} \ ++ 127.0.0.1 >/dev/null & + sleep 0.1 +-pids[1]=$! + chk_msk_nr 2 "after MPC handshake " + chk_msk_remote_key_nr 2 "....chk remote_key" + chk_msk_fallback_nr 0 "....chk no fallback" + flush_pids + + +-echo "a" | ip netns exec $ns ./mptcp_connect -p 10001 -s TCP -l 0.0.0.0 -t 100 >/dev/null & +-pids[0]=$! ++echo "a" | \ ++ timeout ${timeout_test} \ ++ ip netns exec $ns \ ++ ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} \ ++ 0.0.0.0 >/dev/null & + sleep 0.1 +-echo "b" | ip netns exec $ns ./mptcp_connect -p 10001 127.0.0.1 -j -t 100 >/dev/null & +-pids[1]=$! ++echo "b" | \ ++ timeout ${timeout_test} \ ++ ip netns exec $ns \ ++ ./mptcp_connect -p 10001 -j -t ${timeout_poll} \ ++ 127.0.0.1 >/dev/null & + sleep 0.1 + chk_msk_fallback_nr 1 "check fallback" + flush_pids + + NR_CLIENTS=100 + for I in `seq 1 $NR_CLIENTS`; do +- echo "a" | ip netns exec $ns ./mptcp_connect -p $((I+10001)) -l 0.0.0.0 -t 100 -w 10 >/dev/null & +- pids[$((I*2))]=$! ++ echo "a" | \ ++ timeout ${timeout_test} \ ++ ip netns exec $ns \ ++ ./mptcp_connect -p $((I+10001)) -l -w 10 \ ++ -t ${timeout_poll} 0.0.0.0 >/dev/null & + done + sleep 0.1 + + for I in `seq 1 $NR_CLIENTS`; do +- echo "b" | ip netns exec $ns ./mptcp_connect -p $((I+10001)) 127.0.0.1 -t 100 -w 10 >/dev/null & +- pids[$((I*2 + 1))]=$! ++ echo "b" | \ ++ timeout ${timeout_test} \ ++ ip netns exec $ns \ ++ ./mptcp_connect -p $((I+10001)) -w 10 \ ++ -t ${timeout_poll} 127.0.0.1 >/dev/null & + done + sleep 1.5 + +diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh +index 987a914ee0df..4d94c4e81d49 100755 +--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh ++++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh +@@ -11,7 +11,8 @@ cin="" + cout="" + ksft_skip=4 + capture=false +-timeout=30 ++timeout_poll=30 ++timeout_test=$((timeout_poll * 2 + 1)) + ipv6=true + ethtool_random_on=true + tc_delay="$((RANDOM%50))" +@@ -269,7 +270,7 @@ check_mptcp_disabled() + ip netns exec ${disabled_ns} sysctl -q net.mptcp.enabled=0 + + local err=0 +- LANG=C ip netns exec ${disabled_ns} ./mptcp_connect -t $timeout -p 10000 -s MPTCP 127.0.0.1 < "$cin" 2>&1 | \ ++ LANG=C ip netns exec ${disabled_ns} ./mptcp_connect -p 10000 -s MPTCP 127.0.0.1 < "$cin" 2>&1 | \ + grep -q "^socket: Protocol not available$" && err=1 + ip netns delete ${disabled_ns} + +@@ -411,14 +412,20 @@ do_transfer() + local stat_cookietx_last=$(ip netns exec ${listener_ns} nstat -z -a TcpExtSyncookiesSent | while read a count c rest ;do echo $count;done) + local stat_cookierx_last=$(ip netns exec ${listener_ns} nstat -z -a TcpExtSyncookiesRecv | while read a count c rest ;do echo $count;done) + +- ip netns exec ${listener_ns} ./mptcp_connect -t $timeout -l -p $port -s ${srv_proto} $extra_args $local_addr < "$sin" > "$sout" & ++ timeout ${timeout_test} \ ++ ip netns exec ${listener_ns} \ ++ ./mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ ++ $extra_args $local_addr < "$sin" > "$sout" & + local spid=$! + + wait_local_port_listen "${listener_ns}" "${port}" + + local start + start=$(date +%s%3N) +- ip netns exec ${connector_ns} ./mptcp_connect -t $timeout -p $port -s ${cl_proto} $extra_args $connect_addr < "$cin" > "$cout" & ++ timeout ${timeout_test} \ ++ ip netns exec ${connector_ns} \ ++ ./mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \ ++ $extra_args $connect_addr < "$cin" > "$cout" & + local cpid=$! + + wait $cpid +diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh +index 0eae628d1ffd..1a9c1c0a5692 100755 +--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh ++++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh +@@ -8,7 +8,8 @@ cin="" + cinsent="" + cout="" + ksft_skip=4 +-timeout=30 ++timeout_poll=30 ++timeout_test=$((timeout_poll * 2 + 1)) + mptcp_connect="" + capture=0 + +@@ -249,17 +250,26 @@ do_transfer() + local_addr="0.0.0.0" + fi + +- ip netns exec ${listener_ns} $mptcp_connect -t $timeout -l -p $port \ +- -s ${srv_proto} ${local_addr} < "$sin" > "$sout" & ++ timeout ${timeout_test} \ ++ ip netns exec ${listener_ns} \ ++ $mptcp_connect -t ${timeout_poll} -l -p $port -s ${srv_proto} \ ++ ${local_addr} < "$sin" > "$sout" & + spid=$! + + sleep 1 + + if [ "$test_link_fail" -eq 0 ];then +- ip netns exec ${connector_ns} $mptcp_connect -t $timeout -p $port -s ${cl_proto} $connect_addr < "$cin" > "$cout" & ++ timeout ${timeout_test} \ ++ ip netns exec ${connector_ns} \ ++ $mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \ ++ $connect_addr < "$cin" > "$cout" & + else +- ( cat "$cin" ; sleep 2; link_failure $listener_ns ; cat "$cin" ) | tee "$cinsent" | \ +- ip netns exec ${connector_ns} $mptcp_connect -t $timeout -p $port -s ${cl_proto} $connect_addr > "$cout" & ++ ( cat "$cin" ; sleep 2; link_failure $listener_ns ; cat "$cin" ) | \ ++ tee "$cinsent" | \ ++ timeout ${timeout_test} \ ++ ip netns exec ${connector_ns} \ ++ $mptcp_connect -t ${timeout_poll} -p $port -s ${cl_proto} \ ++ $connect_addr > "$cout" & + fi + cpid=$! + +diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh +index 8fcb28927818..ce832b443475 100755 +--- a/tools/testing/selftests/net/mptcp/simult_flows.sh ++++ b/tools/testing/selftests/net/mptcp/simult_flows.sh +@@ -7,7 +7,8 @@ ns2="ns2-$rndh" + ns3="ns3-$rndh" + capture=false + ksft_skip=4 +-timeout=30 ++timeout_poll=30 ++timeout_test=$((timeout_poll * 2 + 1)) + test_cnt=1 + ret=0 + bail=0 +@@ -157,14 +158,20 @@ do_transfer() + sleep 1 + fi + +- ip netns exec ${ns3} ./mptcp_connect -jt $timeout -l -p $port 0.0.0.0 < "$sin" > "$sout" & ++ timeout ${timeout_test} \ ++ ip netns exec ${ns3} \ ++ ./mptcp_connect -jt ${timeout_poll} -l -p $port \ ++ 0.0.0.0 < "$sin" > "$sout" & + local spid=$! + + wait_local_port_listen "${ns3}" "${port}" + + local start + start=$(date +%s%3N) +- ip netns exec ${ns1} ./mptcp_connect -jt $timeout -p $port 10.0.3.3 < "$cin" > "$cout" & ++ timeout ${timeout_test} \ ++ ip netns exec ${ns1} \ ++ ./mptcp_connect -jt ${timeout_poll} -p $port \ ++ 10.0.3.3 < "$cin" > "$cout" & + local cpid=$! + + wait $cpid +-- +2.35.1 + diff --git a/queue-5.10/selftests-mptcp-more-stable-diag-tests.patch b/queue-5.10/selftests-mptcp-more-stable-diag-tests.patch new file mode 100644 index 00000000000..2d3222da5a0 --- /dev/null +++ b/queue-5.10/selftests-mptcp-more-stable-diag-tests.patch @@ -0,0 +1,134 @@ +From 7751433e2e0357d3d5cb881f865f508af98599d3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jun 2022 18:02:41 -0700 +Subject: selftests: mptcp: more stable diag tests + +From: Paolo Abeni + +[ Upstream commit 42fb6cddec3b306c9f6ef136b6438e0de1836431 ] + +The mentioned test-case still use an hard-coded-len sleep to +wait for a relative large number of connection to be established. + +On very slow VM and with debug build such timeout could be exceeded, +causing failures in our CI. + +Address the issue polling for the expected condition several times, +up to an unreasonable high amount of time. On reasonably fast system +the self-tests will be faster then before, on very slow one we will +still catch the correct condition. + +Fixes: df62f2ec3df6 ("selftests/mptcp: add diag interface tests") +Signed-off-by: Paolo Abeni +Signed-off-by: Mat Martineau +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/net/mptcp/diag.sh | 48 +++++++++++++++++++---- + 1 file changed, 40 insertions(+), 8 deletions(-) + +diff --git a/tools/testing/selftests/net/mptcp/diag.sh b/tools/testing/selftests/net/mptcp/diag.sh +index ff821025d309..49dfabded1d4 100755 +--- a/tools/testing/selftests/net/mptcp/diag.sh ++++ b/tools/testing/selftests/net/mptcp/diag.sh +@@ -61,6 +61,39 @@ chk_msk_nr() + __chk_nr "grep -c token:" $* + } + ++wait_msk_nr() ++{ ++ local condition="grep -c token:" ++ local expected=$1 ++ local timeout=20 ++ local msg nr ++ local max=0 ++ local i=0 ++ ++ shift 1 ++ msg=$* ++ ++ while [ $i -lt $timeout ]; do ++ nr=$(ss -inmHMN $ns | $condition) ++ [ $nr == $expected ] && break; ++ [ $nr -gt $max ] && max=$nr ++ i=$((i + 1)) ++ sleep 1 ++ done ++ ++ printf "%-50s" "$msg" ++ if [ $i -ge $timeout ]; then ++ echo "[ fail ] timeout while expecting $expected max $max last $nr" ++ ret=$test_cnt ++ elif [ $nr != $expected ]; then ++ echo "[ fail ] expected $expected found $nr" ++ ret=$test_cnt ++ else ++ echo "[ ok ]" ++ fi ++ test_cnt=$((test_cnt+1)) ++} ++ + chk_msk_fallback_nr() + { + __chk_nr "grep -c fallback" $* +@@ -109,7 +142,7 @@ ip -n $ns link set dev lo up + echo "a" | \ + timeout ${timeout_test} \ + ip netns exec $ns \ +- ./mptcp_connect -p 10000 -l -t ${timeout_poll} \ ++ ./mptcp_connect -p 10000 -l -t ${timeout_poll} -w 20 \ + 0.0.0.0 >/dev/null & + wait_local_port_listen $ns 10000 + chk_msk_nr 0 "no msk on netns creation" +@@ -117,7 +150,7 @@ chk_msk_nr 0 "no msk on netns creation" + echo "b" | \ + timeout ${timeout_test} \ + ip netns exec $ns \ +- ./mptcp_connect -p 10000 -r 0 -t ${timeout_poll} \ ++ ./mptcp_connect -p 10000 -r 0 -t ${timeout_poll} -w 20 \ + 127.0.0.1 >/dev/null & + wait_connected $ns 10000 + chk_msk_nr 2 "after MPC handshake " +@@ -129,13 +162,13 @@ flush_pids + echo "a" | \ + timeout ${timeout_test} \ + ip netns exec $ns \ +- ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} \ ++ ./mptcp_connect -p 10001 -l -s TCP -t ${timeout_poll} -w 20 \ + 0.0.0.0 >/dev/null & + wait_local_port_listen $ns 10001 + echo "b" | \ + timeout ${timeout_test} \ + ip netns exec $ns \ +- ./mptcp_connect -p 10001 -r 0 -t ${timeout_poll} \ ++ ./mptcp_connect -p 10001 -r 0 -t ${timeout_poll} -w 20 \ + 127.0.0.1 >/dev/null & + wait_connected $ns 10001 + chk_msk_fallback_nr 1 "check fallback" +@@ -146,7 +179,7 @@ for I in `seq 1 $NR_CLIENTS`; do + echo "a" | \ + timeout ${timeout_test} \ + ip netns exec $ns \ +- ./mptcp_connect -p $((I+10001)) -l -w 10 \ ++ ./mptcp_connect -p $((I+10001)) -l -w 20 \ + -t ${timeout_poll} 0.0.0.0 >/dev/null & + done + wait_local_port_listen $ns $((NR_CLIENTS + 10001)) +@@ -155,12 +188,11 @@ for I in `seq 1 $NR_CLIENTS`; do + echo "b" | \ + timeout ${timeout_test} \ + ip netns exec $ns \ +- ./mptcp_connect -p $((I+10001)) -w 10 \ ++ ./mptcp_connect -p $((I+10001)) -w 20 \ + -t ${timeout_poll} 127.0.0.1 >/dev/null & + done +-sleep 1.5 + +-chk_msk_nr $((NR_CLIENTS*2)) "many msk socket present" ++wait_msk_nr $((NR_CLIENTS*2)) "many msk socket present" + flush_pids + + exit $ret +-- +2.35.1 + diff --git a/queue-5.10/series b/queue-5.10/series index f259ac69794..b0e8aca66f1 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -45,3 +45,14 @@ xfs-ensure-xfs_errortag_random_default-matches-xfs_errtag_max.patch xfs-fix-xfs_trans-slab-cache-name.patch xfs-update-superblock-counters-correctly-for-lazysbcount.patch xfs-fix-xfs_reflink_unshare-usage-of-filemap_write_and_wait_range.patch +drivers-cpufreq-add-missing-of_node_put-in-qoriq-cpu.patch +selftests-mptcp-add-add_addr-timeout-test-case.patch +selftests-mptcp-add-link-failure-test-case.patch +selftests-mptcp-add-add_addr-ipv6-test-cases.patch +selftests-mptcp-launch-mptcp_connect-with-timeout.patch +selftests-mptcp-fix-diag-instability.patch +selftests-mptcp-more-stable-diag-tests.patch +tcp-add-a-missing-nf_reset_ct-in-3whs-handling.patch +sit-use-min.patch +ipv6-sit-fix-ipip6_tunnel_get_prl-return-value.patch +hwmon-ibmaem-don-t-call-platform_device_del-if-platf.patch diff --git a/queue-5.10/sit-use-min.patch b/queue-5.10/sit-use-min.patch new file mode 100644 index 00000000000..14be945e0f9 --- /dev/null +++ b/queue-5.10/sit-use-min.patch @@ -0,0 +1,39 @@ +From 750be35fdc888bba49f12e990bb8a6097ccdd057 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 27 Mar 2021 10:29:32 +0100 +Subject: sit: use min + +From: kernel test robot + +[ Upstream commit 284fda1eff8a8b27d2cafd7dc8fb423d13720f21 ] + +Opportunity for min() + +Generated by: scripts/coccinelle/misc/minmax.cocci + +CC: Denis Efremov +Reported-by: kernel test robot +Signed-off-by: kernel test robot +Reviewed-by: David Ahern +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv6/sit.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c +index bab0e99f6e35..0be82586ce32 100644 +--- a/net/ipv6/sit.c ++++ b/net/ipv6/sit.c +@@ -323,7 +323,7 @@ static int ipip6_tunnel_get_prl(struct net_device *dev, struct ifreq *ifr) + + rcu_read_lock(); + +- ca = t->prl_count < cmax ? t->prl_count : cmax; ++ ca = min(t->prl_count, cmax); + + if (!kp) { + /* We don't try hard to allocate much memory for +-- +2.35.1 + diff --git a/queue-5.10/tcp-add-a-missing-nf_reset_ct-in-3whs-handling.patch b/queue-5.10/tcp-add-a-missing-nf_reset_ct-in-3whs-handling.patch new file mode 100644 index 00000000000..c354e3b103e --- /dev/null +++ b/queue-5.10/tcp-add-a-missing-nf_reset_ct-in-3whs-handling.patch @@ -0,0 +1,75 @@ +From da13b6ebf350c7a8ce1ba8bed9cb1e7ed158b07c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jun 2022 05:04:36 +0000 +Subject: tcp: add a missing nf_reset_ct() in 3WHS handling + +From: Eric Dumazet + +[ Upstream commit 6f0012e35160cd08a53e46e3b3bbf724b92dfe68 ] + +When the third packet of 3WHS connection establishment +contains payload, it is added into socket receive queue +without the XFRM check and the drop of connection tracking +context. + +This means that if the data is left unread in the socket +receive queue, conntrack module can not be unloaded. + +As most applications usually reads the incoming data +immediately after accept(), bug has been hiding for +quite a long time. + +Commit 68822bdf76f1 ("net: generalize skb freeing +deferral to per-cpu lists") exposed this bug because +even if the application reads this data, the skb +with nfct state could stay in a per-cpu cache for +an arbitrary time, if said cpu no longer process RX softirqs. + +Many thanks to Ilya Maximets for reporting this issue, +and for testing various patches: +https://lore.kernel.org/netdev/20220619003919.394622-1-i.maximets@ovn.org/ + +Note that I also added a missing xfrm4_policy_check() call, +although this is probably not a big issue, as the SYN +packet should have been dropped earlier. + +Fixes: b59c270104f0 ("[NETFILTER]: Keep conntrack reference until IPsec policy checks are done") +Reported-by: Ilya Maximets +Signed-off-by: Eric Dumazet +Cc: Florian Westphal +Cc: Pablo Neira Ayuso +Cc: Steffen Klassert +Tested-by: Ilya Maximets +Reviewed-by: Ilya Maximets +Link: https://lore.kernel.org/r/20220623050436.1290307-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv4/tcp_ipv4.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c +index 017cd666387f..aba5f3a7231b 100644 +--- a/net/ipv4/tcp_ipv4.c ++++ b/net/ipv4/tcp_ipv4.c +@@ -1980,7 +1980,8 @@ int tcp_v4_rcv(struct sk_buff *skb) + struct sock *nsk; + + sk = req->rsk_listener; +- if (unlikely(tcp_v4_inbound_md5_hash(sk, skb, dif, sdif))) { ++ if (unlikely(tcp_v4_inbound_md5_hash(sk, skb, dif, sdif) || ++ !xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))) { + sk_drops_add(sk, skb); + reqsk_put(req); + goto discard_it; +@@ -2019,6 +2020,7 @@ int tcp_v4_rcv(struct sk_buff *skb) + } + goto discard_and_relse; + } ++ nf_reset_ct(skb); + if (nsk == sk) { + reqsk_put(req); + tcp_v4_restore_cb(skb); +-- +2.35.1 + -- 2.47.3