xserver/Xext
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Peter Hutterer 09cc636e46 sync: fix deletion of counters and fences
Both FreeCounter() and miSyncDestroyFence() iterate over the trigger list
and invoke the CounterDestroyed callback on each trigger.

The CounterDestroyed callback (e.g. SyncAwaitTriggerFired) may call
FreeResource/FreeAwait, which frees the SyncAwaitUnion containing all
SyncAwait structs in the same Await group.

When multiple conditions in a single Await reference the same sync
object (counter or fence), the first callback frees all SyncAwait
structs while subsequent trigger list nodes still reference them. On the
next iteration, reading ptl->next or ptl->pTrigger dereferences freed
memory, leading to a use-after-free.

We need separate fixes for separate issues here to fix this in one go
- use our null-terminated list macro to make sure our next pointer stays
  valid (the code accessed ptl->next after freeing it)
- update the list head before deleting the trigger, eventually this ends
  up being NULL anyway but meanwhile the list head is a valid list
  during CounterDestroyed
- check if we actually do have a trigger before dereferencing the
  callback
- Set all triggers to NULL if they are shared so we don't dereference
  potentially freed memory

This vulnerability was discovered by:
Anonymous working with TrendAI Zero Day Initiative

ZDI-CAN-30159 (miSyncDestroyFence), ZDI-CAN-30163 (FreeCounter)

Assisted-by: Claude:claude-opus-4-6
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2228>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2026-06-03 16:34:10 +02:00
..
damage Xext: damage: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros 2025-12-21 12:01:33 +01:00
namespace xext: namespace: fix printf format string 2025-12-10 19:58:21 +01:00
bigreq.c Xext: bigreq: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros 2025-12-21 11:54:12 +01:00
dpms.c os: move MILLI_PER_MIN and MILLI_PER_SECOND to osdep.h 2025-11-27 11:58:45 +01:00
dpmsproc.h xext: move include guards up to wrap the whole file 2025-11-21 15:20:11 +01:00
geext.c Xext: geext: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros 2025-12-21 11:54:29 +01:00
geext_priv.h xext: add/fix include guards where missing/broken 2025-06-27 13:58:05 +02:00
hashtable.c xext: replace xallocarray() by calloc() 2025-06-12 17:21:43 +02:00
hashtable.h Xext: hashtable.h: unexport functions not used by drivers 2025-06-12 16:51:36 +02:00
meson.build xfree86: move over xf86vidmode extension to hw/xfree86 2025-11-27 14:03:37 +01:00
panoramiX.c panoramiX: fail if we can't allocate our visual arrays 2026-04-30 19:19:20 +02:00
panoramiX.h xext: move include guards up to wrap the whole file 2025-11-21 15:20:11 +01:00
panoramiXh.h Xext: panoramix: inline SProc*()'s 2025-09-17 09:46:27 +02:00
panoramiXprocs.c Xext: consistenly name reply structs "reply" instead of "rep" 2025-12-03 14:29:29 +01:00
panoramiXsrv.h xext: move include guards up to wrap the whole file 2025-11-21 15:20:11 +01:00
saver.c saver: re-fetch screen private after CheckScreenPrivate in CreateSaverWindow 2026-06-03 16:33:37 +02:00
security.c Xext: security: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros 2025-12-21 12:04:33 +01:00
securitysrv.h
shape.c dix: move request/response related functions to new request_priv.h header 2025-09-24 11:32:50 +02:00
shm.c Revert 9a82f5c, bring back Cygwin support. 2025-12-21 12:59:03 +01:00
shm_priv.h Xext: shm: move ShmDescRec definition into shm.c 2025-10-21 20:36:44 +02:00
shmint.h Xext: shm: move ShmDescRec definition into shm.c 2025-10-21 20:36:44 +02:00
sleepuntil.c Xext: sleepuntil: drop obsolete support for internal server reset 2025-11-20 19:26:00 +01:00
sleepuntil.h xext: move include guards up to wrap the whole file 2025-11-21 15:20:11 +01:00
sync.c sync: fix deletion of counters and fences 2026-06-03 16:34:10 +02:00
syncsdk.h
syncsrv.h
xace.c dix: replace XACE_SCREEN_ACCESS by direct callback 2025-10-22 13:53:25 +02:00
xace.h treewide: don't include <region.h> anymore 2025-11-27 19:27:27 +01:00
xacestr.h dix: replace XACE_SCREEN_ACCESS by direct callback 2025-10-22 13:53:25 +02:00
xcmisc.c dix: move request/response related functions to new request_priv.h header 2025-09-24 11:32:50 +02:00
xf86bigfont.c Xext: xf86bigfont: Include osdep.h for OsSignal. 2025-12-21 12:59:03 +01:00
xf86bigfontsrv.h
xres.c Xext/xres: fix undefined behavior in ConstructClientIdValue 2026-04-28 11:02:51 +02:00
xselinux.h
xselinux_ext.c Xext/xselinux: add fast path to ProcSELinuxListSelections() 2025-10-21 13:02:04 +02:00
xselinux_hooks.c selinux: remap security classes on policyload 2026-04-21 10:29:49 +02:00
xselinux_label.c Xext/xselinux: avoid memory leak in SELinuxAtomToSID() 2025-10-21 13:02:04 +02:00
xselinuxint.h
xtest.c Xext: xtest: use REQUEST_HEAD_STRUCT and REQUEST_FIELD_* macros 2025-12-21 11:57:12 +01:00
xvdisp.c xext: xvdisp: fix printf format 2025-12-11 10:28:49 +01:00
xvdisp.h xext: add/fix include guards where missing/broken 2025-06-27 13:58:05 +02:00
xvdix.h treewide: preemptively revert !1714 where it affects ABI compatibility 2025-06-16 10:32:48 +02:00
xvdix_priv.h xv: drop forgotten SProcXvDispatch() prototype 2025-09-29 11:23:48 +02:00
xvmain.c xv: use embedded private instead of pointer 2025-10-26 13:57:49 +01:00
xvmc.c Xext: xvmc: drop dead SHM code path 2025-11-27 13:50:11 +01:00
xvmcext.h