radeon_mn.c is dead code: excluded from the kernel and module builds, gated on CONFIG_MMU_NOTIFIER which is never defined, and not even compilable if re-enabled (missing mmu_notifier compat API)
Summary
Commented out of both builds (sys/conf/files:2557, radeon/Makefile:107); kconfig.h never defines CONFIG_MMU_NOTIFIER so radeon.h compiles -ENODEV stubs - GEM userptr REGISTER can never reach it. Guest-verified zero radeon_mn symbols in radeon.ko and kernel image. If resurrected it will not build (5-arg blockable invalidate_range_start, __mmu_notifier_register, unregister - none exist in the LinuxKPI). Latent hazards documented: rmn->lock vs reservation AB-BA, end-=1 empty-range wrap, no rmn refcount. Same dead status expected for amdgpu_mn.c/i915_gem_userptr.c notifier halves.
Discussion (0)
PoC verification
Evidence pack
findings/poc/DF-5018 Β· 5 files| File | Type | Description | Size | |
|---|---|---|---|---|
| README.md | β | 3.2 KB | β raw | |
| VERDICT.md | β | 4.2 KB | β raw | |
| evidence.txt | β | 1.4 KB | view raw | |
| manifest.json | β | 839 B | view raw | |
| verdict.json | β | 3.3 KB | view raw |
DF-5018 β radeon_mn.c is dead code: excluded from every build, and cannot compile if re-enabled
What
sys/dev/drm/radeon/radeon_mn.c β the radeon MMU-notifier / userptr
invalidation path β is not compiled anywhere in DragonFly:
- kernel build:
sys/conf/files:2557-2558β the file is commented out ("Only build radeon_mn.c if CONFIG_MMU_NOTIFIER is set"); - radeon KMOD build:
sys/dev/drm/radeon/Makefile:107β# radeon_mn.c; sys/dev/drm/kconfig.hnever definesCONFIG_MMU_NOTIFIER, soradeon.h:1794-1803compiles the stub versions:radeon_mn_register()returns-ENODEV,radeon_mn_unregister()is a no-op. The GEM userptr ioctl path (radeon_gem.c:339) therefore can never reach this file on any DragonFly system;- guest-verified:
nm /boot/kernel/radeon.ko | grep -c radeon_mn= 0,nm /boot/kernel/kernel= 0 (see evidence.txt).
Additionally, the file cannot be resurrected as-is: it uses a
bool blockable parameter (radeon_mn.c:125) and calls
__mmu_notifier_register (radeon_mn.c:227) and mmu_notifier_unregister
(radeon_mn.c:90), none of which exist in DragonFly's compat layer
(sys/dev/drm/include/linux/mmu_notifier.h declares a 4-arg
invalidate_range_start with no blockable, and no register/unregister
functions exist anywhere in the tree β verified by grep). Enabling it
without first porting a real mmu_notifier implementation is a
compile/link error, not a runtime path.
Why this is a finding (pass 2)
Pass 1 recorded no findings for this file. The pass-2 value is the durable
record that (a) every bo->mn / userptr-invalidation hazard in radeon is
unreachable on DragonFly as shipped, and (b) the latent hazards below
exist should anyone wire the notifier up.
Latent hazards if ever re-enabled (documented, not reachable)
- AB-BA lock order:
radeon_mn_invalidate_range_startholdsrmn->lockwhile reserving BOs (radeon_bo_reserve, line 162) and validating them (line 174, takesbo->tbo.resv);radeon_mn_unregistertakesrdev->mn_lockβrmn->lockand is called from the BO teardown path which can hold reservation objects. Invalidate(regv) vs teardown(mn_lock) can deadlock. end -= 1wrap (line 133): aninvalidate_range_startcall withstart == end == 0wrapsendto ULONG_MAX and matches the entire interval tree, stalling on every registered BO.- No refcount on
rmnreturned byradeon_mn_getβ lifetime is bound tommteardown serialization only.
Verification
No runtime PoC is applicable (nothing to trigger). The dead-code claims are
machine-verified on the audit guest β evidence.txt:
== radeon_mn in kernel build? == sys/conf/files:2557-2558 (commented out) == radeon_mn in module Makefile? == radeon/Makefile:107 (commented out) == CONFIG_MMU_NOTIFIER in kconfig.h? == 0 (ABSENT) == radeon_mn symbols in built radeon.ko == 0 ; in kernel == 0
Recommended action
Either delete the file (matching its build status) or port a real mmu_notifier compat layer before re-enabling β and fix the three latent hazards above at the same time. Severity: Info (defense-in-depth / dead-code hygiene; no runtime attack surface today).
DF-5018 β radeon_mn.c is dead code: excluded from every build, and cannot compile if re-enabled
What
sys/dev/drm/radeon/radeon_mn.c β the radeon MMU-notifier / userptr
invalidation path β is not compiled anywhere in DragonFly:
- kernel build:
sys/conf/files:2557-2558β the file is commented out ("Only build radeon_mn.c if CONFIG_MMU_NOTIFIER is set"); - radeon KMOD build:
sys/dev/drm/radeon/Makefile:107β# radeon_mn.c; sys/dev/drm/kconfig.hnever definesCONFIG_MMU_NOTIFIER, soradeon.h:1794-1803compiles the stub versions:radeon_mn_register()returns-ENODEV,radeon_mn_unregister()is a no-op. The GEM userptr ioctl path (radeon_gem.c:339) therefore can never reach this file on any DragonFly system;- guest-verified:
nm /boot/kernel/radeon.ko | grep -c radeon_mn= 0,nm /boot/kernel/kernel= 0 (see evidence.txt).
Additionally, the file cannot be resurrected as-is: it uses a
bool blockable parameter (radeon_mn.c:125) and calls
__mmu_notifier_register (radeon_mn.c:227) and mmu_notifier_unregister
(radeon_mn.c:90), none of which exist in DragonFly's compat layer
(sys/dev/drm/include/linux/mmu_notifier.h declares a 4-arg
invalidate_range_start with no blockable, and no register/unregister
functions exist anywhere in the tree β verified by grep). Enabling it
without first porting a real mmu_notifier implementation is a
compile/link error, not a runtime path.
Why this is a finding (pass 2)
Pass 1 recorded no findings for this file. The pass-2 value is the durable
record that (a) every bo->mn / userptr-invalidation hazard in radeon is
unreachable on DragonFly as shipped, and (b) the latent hazards below
exist should anyone wire the notifier up.
Latent hazards if ever re-enabled (documented, not reachable)
- AB-BA lock order:
radeon_mn_invalidate_range_startholdsrmn->lockwhile reserving BOs (radeon_bo_reserve, line 162) and validating them (line 174, takesbo->tbo.resv);radeon_mn_unregistertakesrdev->mn_lockβrmn->lockand is called from the BO teardown path which can hold reservation objects. Invalidate(regv) vs teardown(mn_lock) can deadlock. end -= 1wrap (line 133): aninvalidate_range_startcall withstart == end == 0wrapsendto ULONG_MAX and matches the entire interval tree, stalling on every registered BO.- No refcount on
rmnreturned byradeon_mn_getβ lifetime is bound tommteardown serialization only.
Verification
No runtime PoC is applicable (nothing to trigger). The dead-code claims are
machine-verified on the audit guest β evidence.txt:
== radeon_mn in kernel build? == sys/conf/files:2557-2558 (commented out) == radeon_mn in module Makefile? == radeon/Makefile:107 (commented out) == CONFIG_MMU_NOTIFIER in kconfig.h? == 0 (ABSENT) == radeon_mn symbols in built radeon.ko == 0 ; in kernel == 0
Recommended action
Either delete the file (matching its build status) or port a real mmu_notifier compat layer before re-enabling β and fix the three latent hazards above at the same time. Severity: Info (defense-in-depth / dead-code hygiene; no runtime attack surface today).
Status: UNTESTED (by design β Info/dead-code finding, no runtime PoC applicable)
The finding's claims are source- and image-level and were machine-verified (evidence.txt): the file is absent from the kernel build (sys/conf/files:2557- 2558), absent from the radeon KMOD (radeon/Makefile:107), CONFIG_MMU_NOTIFIER is undefined (kconfig.h), the stubs in radeon.h:1794-1803 are what actually compile, and no radeon_mn symbols exist in /boot/kernel/radeon.ko or the kernel image. Nothing can be executed; there is no trigger, no panic, no leak. The correct disposition is Info severity, no fix validation.
Fix status (batch validation)
Applied with the 36 sibling fix.diffs of this batch in findings/poc/_batch41/all_fixes.patch; single in-guest make -j6 nativekernel KERNCONF=X86_64_GENERIC completed RC=0 with zero errors under -Werror (full log: findings/poc/_batch41/fix_build8.log). Behavior A/B intentionally skipped for this Info-tier item.
(No fix.diff for this item: documented recommendation only - see Fix above.)
Fix verification
not_testablenot_applicable: Info-severity dead-code finding, nothing to fix-validate at runtime.
evidence.txt documents the dead-build state that constitutes the finding itself.
Confirmed kernel references
Detail
Evidence (decisive lines)
evidence.txt (machine-verified on guest): sys/conf/files:2557-2558 commented; radeon/Makefile:107 commented; grep -c MMU_NOTIFIER kconfig.h = 0; nm radeon.ko and nm kernel contain zero radeon_mn symbols; radeon.h stub block quoted; compat mmu_notifier_ops has no blockable param; __mmu_notifier_register appears only as call sites, never defined.
PoC changes
No PoC source (nothing to execute). Evidence collected via a read-only shell script on the audit guest.
Verified recommended fix
Delete sys/dev/drm/radeon/radeon_mn.c (matching its build status), or port a real mmu_notifier compat layer first and fix the latent AB-BA lock order, the end-=1 empty-range wrap, and the missing rmn refcount before re-enabling.
Verdict
radeon_mn.c is dead code on DragonFly: excluded from the kernel build (sys/conf/files:2557-2558 commented out), excluded from the radeon KMOD build (sys/dev/drm/radeon/Makefile:107 commented out), and gated behind CONFIG_MMU_NOTIFIER which kconfig.h never defines, so radeon.h:1794-1803 compiles -ENODEV stubs instead. Guest-verified: zero radeon_mn symbols in /boot/kernel/radeon.ko and in the kernel image (evidence.txt). The file additionally cannot compile if re-enabled as-is: its 5-arg blockable invalidate_range_start (radeon_mn.c:121-125), __mmu_notifier_register (radeon_mn.c:227) and mmu_notifier_unregister (radeon_mn.c:90) do not exist in sys/dev/drm/include/linux/mmu_notifier.h or anywhere in the tree. All bo->mn / userptr-invalidation hazards in the radeon driver are therefore unreachable as shipped; the latent hazards documented for posterity (rmn->lock vs reservation-object AB-BA in invalidate_range_start vs unregister paths, the end-=1 empty-range wrap at radeon_mn.c:133, and the missing rmn refcount) only matter if a real mmu_notifier compat layer is ever ported. Info severity; no runtime PoC applicable, hence status untested rather than a runtime verdict.
No comments yet.