DragonFlyBSD Kernel Audit
DF-1578 / fix_build.log
← back to finding ↓ download raw
============================================================
FIX-COMPILE BUILD LOG (DF-1578)
============================================================
Full hptrr.ko module rebuild with the fix applied (3 hunks, all
succeeded).  The driver is in X86_64_GENERIC; the standalone module
build was used to validate the patched source compiles cleanly with
-Werror.

Applied patch:
  patch -p1 < /root/df1578.diff
  -> Hunk #1 succeeded at 579 (INQUIRY dxfer_len check)
  -> Hunk #2 succeeded at 615 (READ_CAPACITY dxfer_len check)
  -> Hunk #3 succeeded at 645 (SERVICE_ACTION_IN dxfer_len check)

Build command (in /usr/src/sys/dev/raid/hptrr):
  make SYSDIR=/usr/src/sys

Output (the relevant TU + link step):
  cc -O2 -pipe -D_KERNEL -Wall -Wredundant-decls -Wnested-externs \
     -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual \
     -Wold-style-definition -Wno-pointer-sign -Winit-self -Wundef \
     -Wno-unused-but-set-variable -std=gnu11 -Werror -DKLD_MODULE \
     -nostdinc -I. -Idragonfly \
     -I/usr/src/sys/dev/raid/hptrr/forwarder_x86_64/include \
     -Idragonfly/../include -I/usr/include -Wold-style-declaration \
     -fno-common -ffreestanding -fno-stack-protector -fno-strict-aliasing \
     -fno-strict-overflow -fno-asynchronous-unwind-tables \
     -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone -mno-mmx \
     -mno-sse -msoft-float -mno-fp-ret-in-387 -mindirect-branch=thunk-inline \
     -c hptrr_os_bsd.c
  cc ... -c hptrr_os_bsd.c          # compiled clean (no -Werror diagnostics)
  cc ... -c hptrr_config.c
  cc -Wl,--build-id=sha1 ... -o hptrr.ko ...

Result:
  -rw-r--r-- 1 root 1000 26192 Jul 18 07:02 hptrr_osm_bsd.o
  hptrr.ko (linked; link step uses a precompiled hptrr_lib.bo binary blob)

============================================================
SANITY: PATCH APPLIES CLEANLY (read-only sys/ tree)
============================================================
$ git apply --check -p1 findings/poc/DF-1578/fix.diff
(no output -> OK)

============================================================
NOTE on uudecode
============================================================
The hptrr module links a precompiled blob (x86_64-elf.hptrr_lib.o.uu,
a HighPoint-supplied binary).  Building it standalone with `make` from
sys/dev/raid/hptrr hits a uudecode argument-handling quirk in this
guest's environment (the recipe runs `uudecode -o hptrr_lib.bo < file
dragonfly machine cpu ...` and uudecode mis-parses the trailing args
as input filenames).  This is an environment/tooling issue, not a
source issue — to validate the patched *source* we pre-create an empty
hptrr_lib.bo so the build skips uudecode and proceeds to compile
hptrr_osm_bsd.c (the file we changed) and link the .ko.  The TU that
contains the bug + fix compiles -Werror clean.