Skip to content

test(dmabuf): enforce sync_file fence ordering stress test across concurrent GPU <-> TPU handoffs (#15) - #31

Merged
saariuslystoned merged 3 commits into
mainfrom
feat/15-dmabuf-fence-ordering-stress
Nov 30, 2026
Merged

saariuslystoned merged 3 commits into
mainfrom
feat/15-dmabuf-fence-ordering-stress

Conversation

@saariuslystoned

Copy link
Copy Markdown
Contributor

Closes #15.

Summary

  • DMA-BUF sync_file fence ordering hardening (src/fs_dmabuf.cpp): enforces strict monotonic fence sequence ordering on handoffs, rejects duplicate/stale/errored fence signals (FS_ERR_FENCE), and rolls back owner, generation, and last_fence atomically if ensure_mapped fails.
  • Deterministic multi-handoff & concurrency stress test (tests/test_freesched.cpp): adds test_dmabuf_fence_ordering_stress (Test 8) exercising 1,000 sequential FS_DEV_GPU_VK -> FS_DEV_TPU -> FS_DEV_CPU_NEON handoffs + 4-thread × 250 concurrent handoffs (2,003 total zero-copy transitions), asserting fallback_copies == 0, strict FS_ERR_OWNERSHIP on stale generation tokens/owners, and strict FS_ERR_FENCE on replayed/out-of-order/errored fences.

Verification

  • make clean && make verify: PASS (0 warnings under -std=c11/-std=c++17 -Wall -Wextra -Werror, all 8 suites, clean-room audit 0 errors).
  • ASan+UBSan (-fsanitize=address,undefined): 8/8 suites PASS.
  • TSan (-fsanitize=thread): 8/8 suites PASS (0 races).

@saariuslystoned

Copy link
Copy Markdown
Contributor Author

Adversarial Hardening & Public-Roads Audit Receipt (293dfdef)

  • Prior PR head: f3784755 → Hardened head: 293dfdef
  • Fixes landed (src/fs_dmabuf.cpp, tests/test_freesched.cpp):
    • Reject invalid fds (< -1), clamp poll() timeouts to INT_MAX, skip 0 on fence sequence wraparound
    • Guard allocation & refcount integer overflow
    • Snapshot rollback before mutation + ABA guard + fd dup/leak closure
  • Verification: make test PASS, make verify-headers PASS, ASan+UBSan PASS (test_freesched + test_c11_abi + adversarial fuzz), TSan PASS (4x1000 concurrent stress + fuzz), ./scripts/clean-room-audit.sh PASS (0 violations; private-term diff scan clean).

@saariuslystoned
saariuslystoned merged commit 7b60466 into main Nov 30, 2026
5 checks passed
@saariuslystoned
saariuslystoned deleted the feat/15-dmabuf-fence-ordering-stress branch November 30, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Screener] Enforce DMA-BUF sync_file fence ordering stress test under concurrent GPU <-> TPU handoffs

1 participant