⬢ DragonFlyBSD Kernel Audit
DF-4838 / static_check.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-4838 static proof: the amdgpu MMU-notifier path is triple-dead on DragonFly.
# Run from repo root (host) or with /usr/src paths on the guest.
SRC=${SRC:-sys}
[ -d /usr/src/sys ] && [ ! -d sys ] && SRC=/usr/src/sys

echo "== 1. CONFIG_MMU_NOTIFIER is never defined anywhere in the drm build:"
grep -rn "define CONFIG_MMU_NOTIFIER" $SRC/dev/drm/ || echo "   (no definition found -> amdgpu_mn.h:37 takes the #else stub branch)"

echo "== 2. amdgpu_mn.c is NOT in the amdgpu module SRCS:"
grep -n "amdgpu_mn" $SRC/dev/drm/amd/amdgpu/Makefile || echo "   (absent -> file is not compiled)"

echo "== 3. The mmu_notifier shim declares no registration API and no caller exists:"
grep -rn "__mmu_notifier_register" $SRC/ | grep -v "amdgpu_mn.c\|radeon_mn.c\|i915_gem_userptr.c" || echo "   (only call sites, no definition anywhere in sys/)"

echo "== 4. amdgpu userptr ioctl is stubbed to -EINVAL:"
sed -n '/^int amdgpu_gem_userptr_ioctl/,/^#if 0/p' $SRC/dev/drm/amd/amdgpu/amdgpu_gem.c | head -5

echo "== 5. struct aac_fib data area vs struct aac_aif_command size (DF-1922 sibling check):"
grep -n "AAC_FIB_DATASIZE" $SRC/dev/raid/aac/aacreg.h | head -2