Skip to content

Commit 5606382

Browse files
mrprePaolo Abeni
authored andcommitted
selftests: team: add non-Ethernet header_ops reproducer
Add a team selftest that sets up: g0 (gre) -> b0 (bond) -> t0 (team) and triggers IPv6 traffic on t0. This reproduces the non-Ethernet header_ops confusion scenario and protects against regressions in stacked team/bond/gre configurations. Using this script, the panic reported by syzkaller can be reproduced [1]. After the fix: # ./non_ether_header_ops.sh PASS: non-Ethernet header_ops stacking did not crash [1] https://syzkaller.appspot.com/bug?extid=3d8bc31c45e11450f24c Cc: Jiayuan Chen <[email protected]> Signed-off-by: Jiayuan Chen <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 425000d commit 5606382

3 files changed

Lines changed: 44 additions & 0 deletions

File tree

tools/testing/selftests/drivers/net/team/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
TEST_PROGS := \
55
dev_addr_lists.sh \
6+
non_ether_header_ops.sh \
67
options.sh \
78
propagation.sh \
89
refleak.sh \
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
CONFIG_BONDING=y
12
CONFIG_DUMMY=y
23
CONFIG_IPV6=y
34
CONFIG_MACVLAN=y
45
CONFIG_NETDEVSIM=m
6+
CONFIG_NET_IPGRE=y
57
CONFIG_NET_TEAM=y
68
CONFIG_NET_TEAM_MODE_ACTIVEBACKUP=y
79
CONFIG_NET_TEAM_MODE_LOADBALANCE=y
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-2.0
3+
# shellcheck disable=SC2154
4+
#
5+
# Reproduce the non-Ethernet header_ops confusion scenario with:
6+
# g0 (gre) -> b0 (bond) -> t0 (team)
7+
#
8+
# Before the fix, direct header_ops inheritance in this stack could call
9+
# callbacks with the wrong net_device context and crash.
10+
11+
lib_dir=$(dirname "$0")
12+
source "$lib_dir"/../../../net/lib.sh
13+
14+
trap cleanup_all_ns EXIT
15+
16+
setup_ns ns1
17+
18+
ip -n "$ns1" link add d0 type dummy
19+
ip -n "$ns1" addr add 10.10.10.1/24 dev d0
20+
ip -n "$ns1" link set d0 up
21+
22+
ip -n "$ns1" link add g0 type gre local 10.10.10.1
23+
ip -n "$ns1" link add b0 type bond mode active-backup
24+
ip -n "$ns1" link add t0 type team
25+
26+
ip -n "$ns1" link set g0 master b0
27+
ip -n "$ns1" link set b0 master t0
28+
29+
ip -n "$ns1" link set g0 up
30+
ip -n "$ns1" link set b0 up
31+
ip -n "$ns1" link set t0 up
32+
33+
# IPv6 address assignment triggers MLD join reports that call
34+
# dev_hard_header() on t0, exercising the inherited header_ops path.
35+
ip -n "$ns1" -6 addr add 2001:db8:1::1/64 dev t0 nodad
36+
for i in $(seq 1 20); do
37+
ip netns exec "$ns1" ping -6 -I t0 ff02::1 -c1 -W1 &>/dev/null || true
38+
done
39+
40+
echo "PASS: non-Ethernet header_ops stacking did not crash"
41+
exit "$EXIT_STATUS"

0 commit comments

Comments
 (0)