Skip to content

Commit 2945ff7

Browse files
tammelaPaolo Abeni
authored andcommitted
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 <[email protected]> Signed-off-by: Pedro Tammela <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent ac9fe7d commit 2945ff7

File tree

1 file changed

+35
-0
lines changed
  • tools/testing/selftests/tc-testing/tc-tests/infra

1 file changed

+35
-0
lines changed

tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,5 +600,40 @@
600600
"matchPattern": "qdisc hfsc",
601601
"matchCount": "1",
602602
"teardown": ["$TC qdisc del dev $DEV1 root handle 1: drr"]
603+
},
604+
{
605+
"id": "309e",
606+
"name": "Test HFSC eltree double add with reentrant enqueue behaviour on netem",
607+
"category": [
608+
"qdisc",
609+
"hfsc"
610+
],
611+
"plugins": {
612+
"requires": "nsPlugin"
613+
},
614+
"setup": [
615+
"$IP link set dev $DUMMY up || true",
616+
"$IP addr add 10.10.11.10/24 dev $DUMMY || true",
617+
"$TC qdisc add dev $DUMMY root handle 1: tbf rate 8bit burst 100b latency 1s",
618+
"$TC qdisc add dev $DUMMY parent 1:0 handle 2:0 hfsc",
619+
"ping -I $DUMMY -f -c10 -s48 -W0.001 10.10.11.1 || true",
620+
"$TC class add dev $DUMMY parent 2:0 classid 2:1 hfsc rt m2 20Kbit",
621+
"$TC qdisc add dev $DUMMY parent 2:1 handle 3:0 netem duplicate 100%",
622+
"$TC class add dev $DUMMY parent 2:0 classid 2:2 hfsc rt m2 20Kbit",
623+
"$TC filter add dev $DUMMY parent 2:0 protocol ip prio 1 u32 match ip dst 10.10.11.2/32 flowid 2:1",
624+
"$TC filter add dev $DUMMY parent 2:0 protocol ip prio 2 u32 match ip dst 10.10.11.3/32 flowid 2:2",
625+
"ping -c 1 10.10.11.2 -I$DUMMY > /dev/null || true",
626+
"$TC filter del dev $DUMMY parent 2:0 protocol ip prio 1",
627+
"$TC class del dev $DUMMY classid 2:1",
628+
"ping -c 1 10.10.11.3 -I$DUMMY > /dev/null || true"
629+
],
630+
"cmdUnderTest": "$TC class change dev $DUMMY parent 2:0 classid 2:2 hfsc sc m2 20Kbit",
631+
"expExitCode": "0",
632+
"verifyCmd": "$TC -j class ls dev $DUMMY classid 2:1",
633+
"matchJSON": [],
634+
"teardown": [
635+
"$TC qdisc del dev $DUMMY handle 1:0 root",
636+
"$IP addr del 10.10.10.10/24 dev $DUMMY || true"
637+
]
603638
}
604639
]

0 commit comments

Comments
 (0)