Skip to content

Commit 5d17af9

Browse files
n132kuba-moo
authored andcommitted
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 <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Reviewed-by: Victor Nogueira <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4576100 commit 5d17af9

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

  • tools/testing/selftests/tc-testing/tc-tests/infra

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,5 +1111,30 @@
11111111
"teardown": [
11121112
"$TC qdisc del dev $DUMMY root handle 1:"
11131113
]
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+
]
11141139
}
11151140
]

0 commit comments

Comments
 (0)