DragonFlyBSD Kernel Audit
DF-0441 / run.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-0441 run: enable ALTQ + CBQ root class, then add a child class with
# ns_per_byte=0.  On the unpatched kernel this panics with integer divide
# fault in rmc_newclass.  Run as root; pf.ko must be loaded.
#
# Required setup (root, one-time):
#   kldload pf.ko
#
# Expected (bug present):   guest panics, "Fatal trap 18: integer divide
#                            fault ... Stopped at rmc_newclass+0x10a: divl"
# Expected (bug fixed):     "UNEXPECTED: child class added without panic (qid=2)"
#                           (nsecPerByte clamped to 1 by the fix)
pf_present=$(kldstat | grep -c '^.*pf.ko')
[ "$pf_present" -lt 1 ] && kldload pf.ko
exec ./cbq_div0