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

Configure Feed

Select the types of activity you want to include in your feed.

selftests/tc-testing: add test for HFSC divide-by-zero in rtsc_min()

Add a regression test for the divide-by-zero in rtsc_min() triggered
when m2sm() converts a large m1 value (e.g. 32gbit) to a u64 scaled
slope reaching 2^32. rtsc_min() stores the difference of two such u64
values (sm1 - sm2) in a u32 variable `dsm`, truncating 2^32 to zero
and causing a divide-by-zero oops in the concave-curve intersection
path. The test configures an HFSC class with m1=32gbit d=1ms m2=0bit,
sends a packet to activate the class, waits for it to drain and go
idle, then sends another packet to trigger reactivation through
rtsc_min().

Signed-off-by: Xiang Mei <xmei5@asu.edu>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Victor Nogueira <victor@mojatatu.com>
Link: https://patch.msgid.link/20260326204310.1549327-2-xmei5@asu.edu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Xiang Mei and committed by
Jakub Kicinski
5d17af9e 4576100b

+25
+25
tools/testing/selftests/tc-testing/tc-tests/infra/qdiscs.json
··· 1111 1111 "teardown": [ 1112 1112 "$TC qdisc del dev $DUMMY root handle 1:" 1113 1113 ] 1114 + }, 1115 + { 1116 + "id": "a3d7", 1117 + "name": "HFSC with large m1 - no divide-by-zero on class reactivation", 1118 + "category": [ 1119 + "qdisc", 1120 + "hfsc" 1121 + ], 1122 + "plugins": { 1123 + "requires": "nsPlugin" 1124 + }, 1125 + "setup": [ 1126 + "$TC qdisc replace dev $DUMMY root handle 1: hfsc default 1", 1127 + "$TC class replace dev $DUMMY parent 1: classid 1:1 hfsc rt m1 32gbit d 1ms m2 0bit ls m1 32gbit d 1ms m2 0bit", 1128 + "ping -I$DUMMY -f -c1 -s64 -W1 10.10.10.1 || true", 1129 + "sleep 1" 1130 + ], 1131 + "cmdUnderTest": "ping -I$DUMMY -f -c1 -s64 -W1 10.10.10.1 || true", 1132 + "expExitCode": "0", 1133 + "verifyCmd": "$TC qdisc show dev $DUMMY", 1134 + "matchPattern": "qdisc hfsc 1: root", 1135 + "matchCount": "1", 1136 + "teardown": [ 1137 + "$TC qdisc del dev $DUMMY handle 1: root" 1138 + ] 1114 1139 } 1115 1140 ]