Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests: bonding: cause oops in bond_rr_gen_slave_id

This bonding selftest used to cause a kernel oops on aarch64
and should be architectures agnostic.

Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
Acked-by: Jay Vosburgh <jay.vosburgh@canonical.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Jonathan Toppins and committed by
Jakub Kicinski
2ffd5732 0e400d60

+51 -1
+2 -1
tools/testing/selftests/drivers/net/bonding/Makefile
··· 2 2 # Makefile for net selftests 3 3 4 4 TEST_PROGS := bond-break-lacpdu-tx.sh \ 5 - dev_addr_lists.sh 5 + dev_addr_lists.sh \ 6 + bond-arp-interval-causes-panic.sh 6 7 7 8 TEST_FILES := lag_lib.sh 8 9
+49
tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh
··· 1 + #!/bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # cause kernel oops in bond_rr_gen_slave_id 5 + DEBUG=${DEBUG:-0} 6 + 7 + set -e 8 + test ${DEBUG} -ne 0 && set -x 9 + 10 + finish() 11 + { 12 + ip netns delete server || true 13 + ip netns delete client || true 14 + ip link del link1_1 || true 15 + } 16 + 17 + trap finish EXIT 18 + 19 + client_ip4=192.168.1.198 20 + server_ip4=192.168.1.254 21 + 22 + # setup kernel so it reboots after causing the panic 23 + echo 180 >/proc/sys/kernel/panic 24 + 25 + # build namespaces 26 + ip link add dev link1_1 type veth peer name link1_2 27 + 28 + ip netns add "server" 29 + ip link set dev link1_2 netns server up name eth0 30 + ip netns exec server ip addr add ${server_ip4}/24 dev eth0 31 + 32 + ip netns add "client" 33 + ip link set dev link1_1 netns client down name eth0 34 + ip netns exec client ip link add dev bond0 down type bond mode 1 \ 35 + miimon 100 all_slaves_active 1 36 + ip netns exec client ip link set dev eth0 down master bond0 37 + ip netns exec client ip link set dev bond0 up 38 + ip netns exec client ip addr add ${client_ip4}/24 dev bond0 39 + ip netns exec client ping -c 5 $server_ip4 >/dev/null 40 + 41 + ip netns exec client ip link set dev eth0 down nomaster 42 + ip netns exec client ip link set dev bond0 down 43 + ip netns exec client ip link set dev bond0 type bond mode 0 \ 44 + arp_interval 1000 arp_ip_target "+${server_ip4}" 45 + ip netns exec client ip link set dev eth0 down master bond0 46 + ip netns exec client ip link set dev bond0 up 47 + ip netns exec client ping -c 5 $server_ip4 >/dev/null 48 + 49 + exit 0