⬢ DragonFlyBSD Kernel Audit
DF-4325 / build.log
← back to finding ↓ download raw
DF-4325/DF-4326 harness build on guest (sf_ring_harness.ko)
============================================================
Phase 1 - first build with the literal index expressions:
  cc (bsd.kmod.mk full flag set, -Werror ... -c sf_ring_harness.c)
  sf_ring_harness.c:123:27: error: array subscript 255 is above array bounds of
      'struct sf_tx_bufdesc_type0[128]' [-Werror=array-bounds]
      cur_tx = &ld->sf_tx_dlist[idx];
  sf_ring_harness.c:195:29: error: array subscript 2047 is above array bounds of
      'struct sf_rx_bufdesc_type0[256]' [-Werror=array-bounds]
      desc = &ld->sf_rx_dlist_big[cur_rx->sf_endidx];
  cc1: all warnings being treated as errors
  -> gcc ITSELF statically proves both OOB indexes (same expression shapes as
     if_sf.c:998 / if_sf.c:940; the driver builds only because its indexes are
     runtime values from DMA descriptors).

Phase 2 - indexes laundered through volatile (so gcc cannot constant-fold),
  harness compiled clean, rc=0:
  $ cp /usr/src/sys/dev/netif/sf/if_sfreg.h /root/kmod/sfring/
  $ cd /root/kmod/sfring && make SYSDIR=/usr/src/sys
  sfring=0
  -rw-r--r-- 1 root wheel 10640 Sep 19 12:19 /root/kmod/sfring/sf_ring_harness.ko

(Interim note: an earlier module revision crashed kldload with a GPF in
 strcmp - root cause was a harness bug, DECLARE_MODULE() was passed the
 handler function instead of a struct moduledata; fixed with
 "static struct moduledata ..._mod = {...}". Not a finding; documented here
 for reproducibility of the build history.)