⬢ DragonFlyBSD Kernel Audit
DF-3861 / leak_fictitious.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-3861 trigger: on a host with AMD hardware, cycle amdgpu attach/detach and
# watch the M_DRM zone grow and the 8-slot table exhaust (EBUSY=16).
N=${1:-10}
if ! pciconf -lv 2>/dev/null | grep -q "vendor     = 'Advanced Micro Devices'"; then
	echo "GUEST-HW-GATE: no AMD GPU on this system; the registration path"
	echo "(amdgpu_device.c:2648) never runs; nothing to cycle. See VERDICT.md."
	exit 0
fi
for i in $(seq 1 "$N"); do
	kldload amdgpu 2>/dev/null
	kldunload amdgpu 2>/dev/null
	# after 8 successful attaches, expect:
	#  "Failed to register fictitious range ... (16)" in dmesg
	dmesg | tail -1
done
echo "--- expected terminal state: EBUSY(16) from vm_phys_fictitious_reg_range"
echo "--- and permanent M_DRM zone growth (vmstat -m | grep drm)"