diff options
author | Aaron Conole <aconole@redhat.com> | 2024-02-07 08:24:16 -0500 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-02-09 12:54:38 -0800 |
commit | bd128f62c365504e1268dc09fcccdfb1f091e93a (patch) | |
tree | 0e9bc6fb2090518ce781dacda64018b89ffe8984 /tools/testing/selftests/net/openvswitch/openvswitch.sh | |
parent | 6e2f90d31fe09f2b852de25125ca875aabd81367 (diff) | |
download | linux-stable-bd128f62c365504e1268dc09fcccdfb1f091e93a.tar.gz linux-stable-bd128f62c365504e1268dc09fcccdfb1f091e93a.tar.bz2 linux-stable-bd128f62c365504e1268dc09fcccdfb1f091e93a.zip |
selftests: openvswitch: Add validation for the recursion test
Add a test case into the netlink checks that will show the number of
nested action recursions won't exceed 16. Going to 17 on a small
clone call isn't enough to exhaust the stack on (most) systems, so
it should be safe to run even on systems that don't have the fix
applied.
Signed-off-by: Aaron Conole <aconole@redhat.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240207132416.1488485-3-aconole@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net/openvswitch/openvswitch.sh')
-rwxr-xr-x | tools/testing/selftests/net/openvswitch/openvswitch.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh index f8499d4c87f3..36e40256ab92 100755 --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh @@ -502,9 +502,22 @@ test_netlink_checks () { wc -l) == 2 ] || \ return 1 + info "Checking clone depth" ERR_MSG="Flow actions may not be safe on all matching packets" PRE_TEST=$(dmesg | grep -c "${ERR_MSG}") ovs_add_flow "test_netlink_checks" nv0 \ + 'in_port(1),eth(),eth_type(0x800),ipv4()' \ + 'clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(clone(drop)))))))))))))))))' \ + >/dev/null 2>&1 && return 1 + POST_TEST=$(dmesg | grep -c "${ERR_MSG}") + + if [ "$PRE_TEST" == "$POST_TEST" ]; then + info "failed - clone depth too large" + return 1 + fi + + PRE_TEST=$(dmesg | grep -c "${ERR_MSG}") + ovs_add_flow "test_netlink_checks" nv0 \ 'in_port(1),eth(),eth_type(0x0806),arp()' 'drop(0),2' \ &> /dev/null && return 1 POST_TEST=$(dmesg | grep -c "${ERR_MSG}") |