mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-16 14:30:06 -04:00
Merge tag 'net-7.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Pull networking fixes from Paolo Abeni:
"Including fixes from IPsec, Bluetooth and netfilter
Current release - regressions:
- wifi: fix dev_alloc_name() return value check
- rds: fix recursive lock in rds_tcp_conn_slots_available
Current release - new code bugs:
- vsock: lock down child_ns_mode as write-once
Previous releases - regressions:
- core:
- do not pass flow_id to set_rps_cpu()
- consume xmit errors of GSO frames
- netconsole: avoid OOB reads, msg is not nul-terminated
- netfilter: h323: fix OOB read in decode_choice()
- tcp: re-enable acceptance of FIN packets when RWIN is 0
- udplite: fix null-ptr-deref in __udp_enqueue_schedule_skb().
- wifi: brcmfmac: fix potential kernel oops when probe fails
- phy: register phy led_triggers during probe to avoid AB-BA deadlock
- eth:
- bnxt_en: fix deleting of Ntuple filters
- wan: farsync: fix use-after-free bugs caused by unfinished tasklets
- xscale: check for PTP support properly
Previous releases - always broken:
- tcp: fix potential race in tcp_v6_syn_recv_sock()
- kcm: fix zero-frag skb in frag_list on partial sendmsg error
- xfrm:
- fix race condition in espintcp_close()
- always flush state and policy upon NETDEV_UNREGISTER event
- bluetooth:
- purge error queues in socket destructors
- fix response to L2CAP_ECRED_CONN_REQ
- eth:
- mlx5:
- fix circular locking dependency in dump
- fix "scheduling while atomic" in IPsec MAC address query
- gve: fix incorrect buffer cleanup for QPL
- team: avoid NETDEV_CHANGEMTU event when unregistering slave
- usb: validate USB endpoints"
* tag 'net-7.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (72 commits)
netfilter: nf_conntrack_h323: fix OOB read in decode_choice()
dpaa2-switch: validate num_ifs to prevent out-of-bounds write
net: consume xmit errors of GSO frames
vsock: document write-once behavior of the child_ns_mode sysctl
vsock: lock down child_ns_mode as write-once
selftests/vsock: change tests to respect write-once child ns mode
net/mlx5e: Fix "scheduling while atomic" in IPsec MAC address query
net/mlx5: Fix missing devlink lock in SRIOV enable error path
net/mlx5: E-switch, Clear legacy flag when moving to switchdev
net/mlx5: LAG, disable MPESW in lag_disable_change()
net/mlx5: DR, Fix circular locking dependency in dump
selftests: team: Add a reference count leak test
team: avoid NETDEV_CHANGEMTU event when unregistering slave
net: mana: Fix double destroy_workqueue on service rescan PCI path
MAINTAINERS: Update maintainer entry for QUALCOMM ETHQOS ETHERNET DRIVER
dpll: zl3073x: Remove redundant cleanup in devm_dpll_init()
selftests/net: packetdrill: Verify acceptance of FIN packets when RWIN is 0
tcp: re-enable acceptance of FIN packets when RWIN is 0
vsock: Use container_of() to get net namespace in sysctl handlers
net: usb: kaweth: validate USB endpoints
...
This commit is contained in:
@@ -4,13 +4,15 @@
|
||||
import datetime
|
||||
import random
|
||||
import re
|
||||
import time
|
||||
from lib.py import ksft_run, ksft_pr, ksft_exit
|
||||
from lib.py import ksft_eq, ksft_ne, ksft_ge, ksft_in, ksft_lt, ksft_true, ksft_raises
|
||||
from lib.py import NetDrvEpEnv
|
||||
from lib.py import EthtoolFamily, NetdevFamily
|
||||
from lib.py import KsftSkipEx, KsftFailEx
|
||||
from lib.py import ksft_disruptive
|
||||
from lib.py import rand_port
|
||||
from lib.py import ethtool, ip, defer, GenerateTraffic, CmdExitFailure
|
||||
from lib.py import cmd, ethtool, ip, defer, GenerateTraffic, CmdExitFailure, wait_file
|
||||
|
||||
|
||||
def _rss_key_str(key):
|
||||
@@ -809,6 +811,98 @@ def test_rss_default_context_rule(cfg):
|
||||
'noise' : (0, 1) })
|
||||
|
||||
|
||||
@ksft_disruptive
|
||||
def test_rss_context_persist_ifupdown(cfg, pre_down=False):
|
||||
"""
|
||||
Test that RSS contexts and their associated ntuple filters persist across
|
||||
an interface down/up cycle.
|
||||
|
||||
"""
|
||||
|
||||
require_ntuple(cfg)
|
||||
|
||||
qcnt = len(_get_rx_cnts(cfg))
|
||||
if qcnt < 6:
|
||||
try:
|
||||
ethtool(f"-L {cfg.ifname} combined 6")
|
||||
defer(ethtool, f"-L {cfg.ifname} combined {qcnt}")
|
||||
except Exception as exc:
|
||||
raise KsftSkipEx("Not enough queues for the test") from exc
|
||||
|
||||
ethtool(f"-X {cfg.ifname} equal 2")
|
||||
defer(ethtool, f"-X {cfg.ifname} default")
|
||||
|
||||
ifup = defer(ip, f"link set dev {cfg.ifname} up")
|
||||
if pre_down:
|
||||
ip(f"link set dev {cfg.ifname} down")
|
||||
|
||||
try:
|
||||
ctx1_id = ethtool_create(cfg, "-X", "context new start 2 equal 2")
|
||||
defer(ethtool, f"-X {cfg.ifname} context {ctx1_id} delete")
|
||||
except CmdExitFailure as exc:
|
||||
raise KsftSkipEx("Create context not supported with interface down") from exc
|
||||
|
||||
ctx2_id = ethtool_create(cfg, "-X", "context new start 4 equal 2")
|
||||
defer(ethtool, f"-X {cfg.ifname} context {ctx2_id} delete")
|
||||
|
||||
port_ctx2 = rand_port()
|
||||
flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port_ctx2} context {ctx2_id}"
|
||||
ntuple_id = ethtool_create(cfg, "-N", flow)
|
||||
defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}")
|
||||
|
||||
if not pre_down:
|
||||
ip(f"link set dev {cfg.ifname} down")
|
||||
ifup.exec()
|
||||
|
||||
wait_file(f"/sys/class/net/{cfg.ifname}/carrier",
|
||||
lambda x: x.strip() == "1", deadline=20)
|
||||
|
||||
remote_addr = cfg.remote_addr_v[cfg.addr_ipver]
|
||||
for _ in range(10):
|
||||
if cmd(f"ping -c 1 -W 1 {remote_addr}", fail=False).ret == 0:
|
||||
break
|
||||
time.sleep(1)
|
||||
else:
|
||||
raise KsftSkipEx("Cannot reach remote host after interface up")
|
||||
|
||||
ctxs = cfg.ethnl.rss_get({'header': {'dev-name': cfg.ifname}}, dump=True)
|
||||
|
||||
data1 = [c for c in ctxs if c.get('context') == ctx1_id]
|
||||
ksft_eq(len(data1), 1, f"Context {ctx1_id} should persist after ifup")
|
||||
|
||||
data2 = [c for c in ctxs if c.get('context') == ctx2_id]
|
||||
ksft_eq(len(data2), 1, f"Context {ctx2_id} should persist after ifup")
|
||||
|
||||
_ntuple_rule_check(cfg, ntuple_id, ctx2_id)
|
||||
|
||||
cnts = _get_rx_cnts(cfg)
|
||||
GenerateTraffic(cfg).wait_pkts_and_stop(20000)
|
||||
cnts = _get_rx_cnts(cfg, prev=cnts)
|
||||
|
||||
main_traffic = sum(cnts[0:2])
|
||||
ksft_ge(main_traffic, 18000, f"Main context traffic distribution: {cnts}")
|
||||
ksft_lt(sum(cnts[2:6]), 500, f"Other context queues should be mostly empty: {cnts}")
|
||||
|
||||
_send_traffic_check(cfg, port_ctx2, f"context {ctx2_id}",
|
||||
{'target': (4, 5),
|
||||
'noise': (0, 1),
|
||||
'empty': (2, 3)})
|
||||
|
||||
|
||||
def test_rss_context_persist_create_and_ifdown(cfg):
|
||||
"""
|
||||
Create RSS contexts then cycle the interface down and up.
|
||||
"""
|
||||
test_rss_context_persist_ifupdown(cfg, pre_down=False)
|
||||
|
||||
|
||||
def test_rss_context_persist_ifdown_and_create(cfg):
|
||||
"""
|
||||
Bring interface down first, then create RSS contexts and bring up.
|
||||
"""
|
||||
test_rss_context_persist_ifupdown(cfg, pre_down=True)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
|
||||
cfg.context_cnt = None
|
||||
@@ -823,7 +917,9 @@ def main() -> None:
|
||||
test_rss_context_out_of_order, test_rss_context4_create_with_cfg,
|
||||
test_flow_add_context_missing,
|
||||
test_delete_rss_context_busy, test_rss_ntuple_addition,
|
||||
test_rss_default_context_rule],
|
||||
test_rss_default_context_rule,
|
||||
test_rss_context_persist_create_and_ifdown,
|
||||
test_rss_context_persist_ifdown_and_create],
|
||||
args=(cfg, ))
|
||||
ksft_exit()
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ TEST_PROGS := \
|
||||
dev_addr_lists.sh \
|
||||
options.sh \
|
||||
propagation.sh \
|
||||
refleak.sh \
|
||||
# end of TEST_PROGS
|
||||
|
||||
TEST_INCLUDES := \
|
||||
|
||||
17
tools/testing/selftests/drivers/net/team/refleak.sh
Executable file
17
tools/testing/selftests/drivers/net/team/refleak.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# shellcheck disable=SC2154
|
||||
|
||||
lib_dir=$(dirname "$0")
|
||||
source "$lib_dir"/../../../net/lib.sh
|
||||
|
||||
trap cleanup_all_ns EXIT
|
||||
|
||||
# Test that there is no reference count leak and that dummy1 can be deleted.
|
||||
# https://lore.kernel.org/netdev/4d69abe1-ca8d-4f0b-bcf8-13899b211e57@I-love.SAKURA.ne.jp/
|
||||
setup_ns ns1 ns2
|
||||
ip -n "$ns1" link add name team1 type team
|
||||
ip -n "$ns1" link add name dummy1 mtu 1499 type dummy
|
||||
ip -n "$ns1" link set dev dummy1 master team1
|
||||
ip -n "$ns1" link set dev dummy1 netns "$ns2"
|
||||
ip -n "$ns2" link del dev dummy1
|
||||
@@ -0,0 +1,27 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
// Some TCP stacks send FINs even though the window is closed. We break
|
||||
// a possible FIN/ACK loop by accepting the FIN.
|
||||
|
||||
--mss=1000
|
||||
|
||||
`./defaults.sh`
|
||||
|
||||
// Establish a connection.
|
||||
+0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
|
||||
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
|
||||
+0 setsockopt(3, SOL_SOCKET, SO_RCVBUF, [20000], 4) = 0
|
||||
+0 bind(3, ..., ...) = 0
|
||||
+0 listen(3, 1) = 0
|
||||
|
||||
+0 < S 0:0(0) win 32792 <mss 1000,nop,wscale 7>
|
||||
+0 > S. 0:0(0) ack 1 <mss 1460,nop,wscale 0>
|
||||
+0 < . 1:1(0) ack 1 win 257
|
||||
|
||||
+0 accept(3, ..., ...) = 4
|
||||
|
||||
+0 < P. 1:60001(60000) ack 1 win 257
|
||||
* > . 1:1(0) ack 60001 win 0
|
||||
|
||||
+0 < F. 60001:60001(0) ack 1 win 257
|
||||
+0 > . 1:1(0) ack 60002 win 0
|
||||
@@ -210,16 +210,21 @@ check_result() {
|
||||
}
|
||||
|
||||
add_namespaces() {
|
||||
local orig_mode
|
||||
orig_mode=$(cat /proc/sys/net/vsock/child_ns_mode)
|
||||
ip netns add "global-parent" 2>/dev/null
|
||||
echo "global" | ip netns exec "global-parent" \
|
||||
tee /proc/sys/net/vsock/child_ns_mode &>/dev/null
|
||||
ip netns add "local-parent" 2>/dev/null
|
||||
echo "local" | ip netns exec "local-parent" \
|
||||
tee /proc/sys/net/vsock/child_ns_mode &>/dev/null
|
||||
|
||||
for mode in "${NS_MODES[@]}"; do
|
||||
echo "${mode}" > /proc/sys/net/vsock/child_ns_mode
|
||||
ip netns add "${mode}0" 2>/dev/null
|
||||
ip netns add "${mode}1" 2>/dev/null
|
||||
done
|
||||
|
||||
echo "${orig_mode}" > /proc/sys/net/vsock/child_ns_mode
|
||||
nsenter --net=/var/run/netns/global-parent \
|
||||
ip netns add "global0" 2>/dev/null
|
||||
nsenter --net=/var/run/netns/global-parent \
|
||||
ip netns add "global1" 2>/dev/null
|
||||
nsenter --net=/var/run/netns/local-parent \
|
||||
ip netns add "local0" 2>/dev/null
|
||||
nsenter --net=/var/run/netns/local-parent \
|
||||
ip netns add "local1" 2>/dev/null
|
||||
}
|
||||
|
||||
init_namespaces() {
|
||||
@@ -237,6 +242,8 @@ del_namespaces() {
|
||||
log_host "removed ns ${mode}0"
|
||||
log_host "removed ns ${mode}1"
|
||||
done
|
||||
ip netns del "global-parent" &>/dev/null
|
||||
ip netns del "local-parent" &>/dev/null
|
||||
}
|
||||
|
||||
vm_ssh() {
|
||||
@@ -287,7 +294,7 @@ check_args() {
|
||||
}
|
||||
|
||||
check_deps() {
|
||||
for dep in vng ${QEMU} busybox pkill ssh ss socat; do
|
||||
for dep in vng ${QEMU} busybox pkill ssh ss socat nsenter; do
|
||||
if [[ ! -x $(command -v "${dep}") ]]; then
|
||||
echo -e "skip: dependency ${dep} not found!\n"
|
||||
exit "${KSFT_SKIP}"
|
||||
@@ -1231,12 +1238,8 @@ test_ns_local_same_cid_ok() {
|
||||
}
|
||||
|
||||
test_ns_host_vsock_child_ns_mode_ok() {
|
||||
local orig_mode
|
||||
local rc
|
||||
local rc="${KSFT_PASS}"
|
||||
|
||||
orig_mode=$(cat /proc/sys/net/vsock/child_ns_mode)
|
||||
|
||||
rc="${KSFT_PASS}"
|
||||
for mode in "${NS_MODES[@]}"; do
|
||||
local ns="${mode}0"
|
||||
|
||||
@@ -1246,15 +1249,13 @@ test_ns_host_vsock_child_ns_mode_ok() {
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! echo "${mode}" > /proc/sys/net/vsock/child_ns_mode; then
|
||||
log_host "child_ns_mode should be writable to ${mode}"
|
||||
if ! echo "${mode}" | ip netns exec "${ns}" \
|
||||
tee /proc/sys/net/vsock/child_ns_mode &>/dev/null; then
|
||||
rc="${KSFT_FAIL}"
|
||||
continue
|
||||
fi
|
||||
done
|
||||
|
||||
echo "${orig_mode}" > /proc/sys/net/vsock/child_ns_mode
|
||||
|
||||
return "${rc}"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user