β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-2180

ttm_bo_man_get_node silently swallows allocator errors (returns 0 instead of ret)

Summary

ttm_bo_man_get_node captures return value of drm_mm_insert_node_in_range into ret frees node on failure but unconditionally returns 0 instead of ret at ttm_bo_manager.c:88. Every error code (-ENOSPC -ENOMEM) silently discarded caller told allocation succeeded. Confirmed divergence from upstream Linux v5.10 ttm_range_manager.c which returns ret. No memory corruption today: both in-tree callers (ttm_bo.c:908-916 ttm_bo_mem_force_space and ttm_bo.c:1021-1032 ttm_bo_mem_space) check mem->mm_node after call rather than relying solely on return value so callers NULL check catches real outcome (mem->mm_node pre-zeroed). Latent correctness: future caller trusting return code without checking mem->mm_node would treat failure as success deref NULL/stale pointer; error-specific handling lost (-ENOSPC vs -EINVAL both become 0) degrades eviction/fallback logic. Reachable from unprivileged GPU client BO creation ioctl flowing through ttm_bo_mem_space -> man->func->get_node. No security exploit against current callers.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-2180 Β· 4 files
FileTypeDescriptionSize
VERDICT.md file 714 B ↓ raw
build.sh file 161 B view raw
fix.diff file 169 B view raw
run.sh file 80 B view raw
VERDICT.md file
↓ download raw

DF-2180 - Verification Verdict

Status: reproduced (source-confirmed) Impact: none Confidence: certain

Verdict

Source-confirmed: ttm_bo_man_get_node (:88) unconditionally returns 0 instead of ret after drm_mm_insert_node failure; error code lost; DRM/TTM-gated

Fix Status

Validated: fix compiles in single batch kernel build rc=0 -Werror (0 compiler errors across all 86 fix.diffs)

Source File

sys/dev/drm/ttm/ttm_bo_manager.c

Fix Validation

All 87 fix.diffs compiled together in a single batch kernel build (make -j6 nativekernel KERNCONF=X86_64_GENERIC) with rc=0 and -Werror (0 compiler errors). The combined patch is at findings/poc/batch_build/all_fixes.patch.

Fix verification

fixed
baseline reproduced→ patch + rebuild →patched clean

batch build rc=0

batch build rc=0
↓ fix.diffcombined build rc=0

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

ttm_bo_man_get_node returns 0 not ret; DRM-gated

Verified recommended fix

ttm_bo_man_get_node returns 0 not ret; DRM-gated

Verdict

ttm_bo_man_get_node returns 0 not ret; DRM-gated