Skip to content

(release/25.0) miext/sync: Handle SIGBUS from truncated shm fences - #4015

Open
metux wants to merge 1 commit into
release/25.0from
pr/release/25.0-miext-sync-handle-sigbus-from-truncated-shm-fences-_2026-10-16_20-12-10
Open

metux wants to merge 1 commit into
release/25.0from
pr/release/25.0-miext-sync-handle-sigbus-from-truncated-shm-fences-_2026-10-16_20-12-10

Conversation

@metux

@metux metux commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

A client can truncate the shared memory backing a DRI3/xshmfence sync
fence and cause SIGBUS when the server accesses it.

Register the mapping with busfault and wrap xshmfence accesses with
sigsetjmp so truncation unwinds safely, then discard the mapping while
keeping the fence XID.

Signed-off-by: Olivier Fourdan ofourdan@redhat.com
Assisted-by: AI
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1911
Part-of: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2270
(cherry picked from commit cd083d9)

A client can truncate the shared memory backing a DRI3/xshmfence sync
fence and cause SIGBUS when the server accesses it.

Register the mapping with busfault and wrap xshmfence accesses with
sigsetjmp so truncation unwinds safely, then discard the mapping while
keeping the fence XID.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Assisted-by: AI
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1911
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2270>
(cherry picked from commit cd083d9)
@metux metux self-assigned this Oct 16, 2026
@metux
metux requested a review from a team October 16, 2026 18:13
metux pushed a commit that referenced this pull request Oct 16, 2026
A client can truncate the shared memory backing a DRI3/xshmfence sync
fence and cause SIGBUS when the server accesses it.

Register the mapping with busfault and wrap xshmfence accesses with
sigsetjmp so truncation unwinds safely, then discard the mapping while
keeping the fence XID.

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Assisted-by: AI
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1911
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2270>
(cherry picked from commit cd083d9)
PR: #4015
@metux

metux commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Automated review — generated by Starfleet ship Enterprise (model: cruiser) on behalf of @metux. Not a human review.

🤖 Automated review — generated by Starfleet ship Enterprise on behalf of @metux. Not a human review.

Summary: Adds BUSFAULT-guarded SIGBUS handling to miext/sync/misyncshm.c. Sync SHM fences now register with the busfault subsystem (introduced in #4016) and use sigsetjmp/siglongjmp to safely handle truncated shared memory fences instead of crashing. Includes fence discard on SIGBUS and registration on fence creation.

Assessment:

  • Backport-worthiness: Yes, crash-safety/DoS fix for the Sync extension, applies to release/25.0.
  • Driver-ABI impact: No - changes are in miext/sync/misyncshm.c, an internal server subsystem. No driver-visible structures or _X_EXPORT symbols affected.
  • Correctness: Uses the existing busfault_set_jmp()/busfault_unregister() API correctly; jmp buffer is cleared after successful access and after longjmp. Safe.

Label: bot-review-passed

@metux metux added the bot-review-passed Automated bot review found no blocking issues label Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-review-passed Automated bot review found no blocking issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants