aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tools
diff options
context:
space:
mode:
authorPedro Tammela <pctammela@mojatatu.com>2025-05-22 15:14:48 -0300
committerPaolo Abeni <pabeni@redhat.com>2025-05-28 08:55:35 +0200
commit2945ff733dee951ed64d0f13cba22348bfc1f438 (patch)
tree2fe30b4d54a65895576f9c93aa8c01678131fceb /tools
parentnet_sched: hfsc: Address reentrant enqueue adding class to eltree twice (diff)
downloadwireguard-linux-2945ff733dee951ed64d0f13cba22348bfc1f438.tar.xz
wireguard-linux-2945ff733dee951ed64d0f13cba22348bfc1f438.zip
selftests/tc-testing: Add a test for HFSC eltree double add with reentrant enqueue behaviour on netem
Reproduce the UAF scenario where netem is a child of HFSC and HFSC is configured to use the eltree. In such case, this TDC test would cause the HFSC class to be added to the eltree twice resulting in a UAF. Reviewed-by: Victor Nogueira <victor@mojatatu.com> Signed-off-by: Pedro Tammela <pctammela@mojatatu.com> Link: https://patch.msgid.link/20250522181448.1439717-3-pctammela@mojatatu.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json35
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json b/tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json
index ddc97ecd8b39..9aa44d8176d9 100644
--- a/tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json
+++ b/tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json
@@ -600,5 +600,40 @@
"matchPattern": "qdisc hfsc",
"matchCount": "1",
"teardown": ["$TC qdisc del dev $DEV1 root handle 1: drr"]
+ },
+ {
+ "id": "309e",
+ "name": "Test HFSC eltree double add with reentrant enqueue behaviour on netem",
+ "category": [
+ "qdisc",
+ "hfsc"
+ ],
+ "plugins": {
+ "requires": "nsPlugin"
+ },
+ "setup": [
+ "$IP link set dev $DUMMY up || true",
+ "$IP addr add 10.10.11.10/24 dev $DUMMY || true",
+ "$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 1s",
+ "$TC qdisc add dev $DUMMY parent 1:0 handle 2:0 hfsc",
+ "ping -I $DUMMY -f -c10 -s48 -W0.001 10.10.11.1 || true",
+ "$TC class add dev $DUMMY parent 2:0 classid 2:1 hfsc rt m2 20Kbit",
+ "$TC qdisc add dev $DUMMY parent 2:1 handle 3:0 netem duplicate 100%",
+ "$TC class add dev $DUMMY parent 2:0 classid 2:2 hfsc rt m2 20Kbit",
+ "$TC filter add dev $DUMMY parent 2:0 protocol ip prio 1 u32 match ip dst 10.10.11.2/32 flowid 2:1",
+ "$TC filter add dev $DUMMY parent 2:0 protocol ip prio 2 u32 match ip dst 10.10.11.3/32 flowid 2:2",
+ "ping -c 1 10.10.11.2 -I$DUMMY > /dev/null || true",
+ "$TC filter del dev $DUMMY parent 2:0 protocol ip prio 1",
+ "$TC class del dev $DUMMY classid 2:1",
+ "ping -c 1 10.10.11.3 -I$DUMMY > /dev/null || true"
+ ],
+ "cmdUnderTest": "$TC class change dev $DUMMY parent 2:0 classid 2:2 hfsc sc m2 20Kbit",
+ "expExitCode": "0",
+ "verifyCmd": "$TC -j class ls dev $DUMMY classid 2:1",
+ "matchJSON": [],
+ "teardown": [
+ "$TC qdisc del dev $DUMMY handle 1:0 root",
+ "$IP addr del 10.10.10.10/24 dev $DUMMY || true"
+ ]
}
]