RootlessEnsureFrame returns without releasing a shaped window's region when the implementation refuses to create the
frame, and RootlessMiValidateTree never releases the exposed region it hands to RootlessComputeClips -- upstream
miValidateTree does.
Both are longstanding.
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
exa/exa_accel.c:239:1: warning: ‘inline’ is not at beginning of declaration
[-Wold-style-declaration]
239 | static Bool inline
| ^~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2272>
The X11 core protocol error code constants (BadRequest, BadValue,
BadWindow, etc.) belong with the other protocol definitions in
proto/x11.py rather than in the client connection module.
Move the canonical definitions to proto/x11.py and re-export them from
xclient.py for backward compatibility. Update all test files to import
from proto.x11 instead.
Assisted-by: Claude:claude-opus-4-6
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2263>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Reported by gcc 16.1:
xkb/xkbUtils.c:1440:39: warning: ‘calloc’ sizes specified with ‘sizeof’ in
the earlier argument and not in the later argument [-Wcalloc-transposed-args]
1440 | dst->geom = calloc(sizeof(XkbGeometryRec), 1);
| ^~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2272>
Wide LineDoubleDash lines drew black on screen under XQuartz while the server's own XGetImage readback showed the
correct pixels, because at depth 24 that readback ignores alpha. Opaque text and dashed arcs take the same path.
fbValidateGC widens a planemask that covers the drawable's depth to cover its full bits per pixel, so the blit and
fill paths can take their all-ones shortcuts. On a rootless server that also writes the alpha channel of the window's
premultiplied surface, which CoreGraphics then composites as black. Rootless keeps that alpha opaque by clearing the
bits from the planemask, but only its own ValidateGC does so, and mi revalidates the GC in the middle of a drawing
operation to swap the foreground for the background pixel. By then the damage layer has unwrapped the rootless funcs
down to fb, so the reassertion never happens and the rest of the operation lands with a zero alpha channel.
Fixes: https://github.com/XQuartz/XQuartz/issues/230
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
The xorg backport 924020906e added a few broken
lines that must not be there and cause FTBS as well as a double-free bug.
Fixes: 924020906e
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
xp_frame_draw() renders the window decorations into the frame's backing store from Xplugin's async queue, but
xprFrameDraw() was the only AppleWM handler that did not stop drawing first. When quartz-wm sends AppleWMFrameDraw
while the server still holds the frame locked, Xplugin re-enters the backing lock on an already-locked window and the
backing store is remapped out from under one of the two writers, surfacing as a SIGBUS writing into a read-only CG
backing store mapping.
This removes the self-inflicted overlap and brings the handler in line with its siblings. It narrows the race rather
than closing it: the ordering problem between the async frame draw and the backing lock is tracked separately.
Fixes: https://github.com/XQuartz/XQuartz/issues/352
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
RootlessUpdateScreenPixmap freed the old backing store before attempting the replacement allocation and returned early
on failure, leaving the screen pixmap's devPrivate.ptr pointing at freed memory.
The published geometry was also only refreshed when the buffer grew, so a screen that shrinks kept advertising its
previous, larger size.
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
darwin.c and bundle_trampoline.c wrapped calls that allocate memory, add input devices, or spawn a process in
assert(), so building with NDEBUG would silently skip the call and leave the guarded variable uninitialized or
unset while still proceeding as if it had succeeded.
darwin.c now calls FatalError() on failure. bundle_trampoline runs before the server attaches to a terminal or
console, so stderr is not visible there; it now logs via os_log_error() and calls abort().
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
The field fontserverFrom was added to XF86InfoRec by previous commit
(taken from Xorg PR #2263), but XF86InfoRec (via xf86Info) is _X_EXPORT'ed
and its layout is part of the NVIDIA driver ABI. Adding a field in the
middle shifts all subsequent fields (glxVisuals, glxVisualsFrom, dri2,
dri3, glamor, etc.), breaking the NVIDIA blob ABI.
Fixing this by moving the field of the struct again into a separate
global field, which is not _X_EXPORT'ed.
See: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2263
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
At this point, allowing X Font Server connections just introduces us to
possible security issues since the code effectively trusts any font
server and few checks are in place.
Since font servers also haven't been used for ages, let's disable
them by default. Use-cases that require them will have to pass
+fontserverconnections on the commandline and/or set the corresponding
ServerFlags option.
The tests are a bit hacky: Debian builds libXfont2 with --disable-fc so
we need to cater for the case where the X server enables fontserver support
but libXfont then blocks it and we still need to treat this as success.
Assisted-by: Claude:claude-opus-4-6
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2263>
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Let PanoramiXCreateConnectionBlock() only return x_rpcbuf_t, not touching
global structures anymore - it's caller will that now.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
The parse-time check added with -crtcs N@WxH compares against
currentScreen->width/height, which is still the value before -screen has run
when -crtcs appears first on the command line:
Xvfb -crtcs 1@900x700 -screen 0 800x600x24 -> accepted, CRTC > screen
Xvfb -screen 0 800x600x24 -crtcs 1@900x700 -> rejected
The documented invariant "CRTC size cannot exceed screen size" therefore only
held for one argument order. Enforce it again in InitOutput, after every
argument has been processed and each screen's final size and CRTC array are
known, so the constraint holds regardless of order.
Verified: the reversed order now fails with
CRTC 0 size 900x700 exceeds screen 0's size 800x600
the ordinary order still fails early at parse time, and -crtcs 2@800x600 on a
1280x1024 screen still yields two CRTCs with the first at 800x600.
Signed-off-by: Enterprise <enterprise@starfleet>
The -crtcs command line switch now understands an optional geometry
specification, N@WxH. When present, W×H is applied to each CRTC created for
the screen, allowing them to be smaller than the underlying screen.
If no size is given, the original behavior is preserved: each CRTC,
and the initial RandR mode, match the screen dimensions.
Help output and the man page have been updated accordingly.
Signed-off-by: Andy Myers <andy.myers@zetier.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2043>
XFixes 6.1 adds a new feature where individual client can demand immediate
server shutdown when it disconnects: the client can set a special flag via
X_XFixesGetClientDisconnectMode request - when it's set and that client
terminates, the server stops event delivery and shuts down immediately.
It's is mainly a security feature for screen lockers: without it, crashing
screen locker leading to the whole session becoming unlocked. This is now
prevented by immediately killing the xserver, so no unauthorized access
to the session is possible anymore.
Another practical use case is when some critical applications must be present
(eg. in certain control centers), and a crash of those should trigger to
immediate fault state or session restart.
For now, the feature can only be enabled explicitly in the xfree86 DDX,
via the AllowForceTerminate boolean config file option. Not enabled at all
on other DDX'es yet.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
1. move the panoramix enabled check into PanoramiXConsolidate()
2. declare a static inline dummy if XINERAMA is not defined,
so callers don't need extra ifdefs anymore.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Instead of extracting them the connection info block, use the original
values (those are written into the connection block at consolidation)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
now that we have dixConnBlockScreenStart(), we don't need the
reference parameter of dixConnBlockScreenStart() anymore.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
probe_if_is_running_single_size_hwcursor_gpu() dereferences the return value
of drmGetVersion() unconditionally:
drmVersionPtr version = drmGetVersion(drmmode->fd);
if (strstr(version->name, "amdgpu")) {
drmGetVersion() returns NULL on failure, so a failure there crashes the driver
during PreInit(). The same driver checks for this in six other places
(ms_is_running_virtual_gpu(), the mgag200 probe, the cursor interleave
helper), so this is a missing check rather than a deliberate one.
Bail out early with fixed_size_cursor left at its initial false, which lets
the regular cursor size probing in drmmode_probe_cursor_size() run exactly as
it does for every other non-amdgpu device. This also keeps drmFreeVersion()
from ever being handed a NULL pointer on the early-return path.
Verified with an isolated harness that stubs drmGetVersion()/drmGetCap():
the code as merged in 46c411e49b dies with SIGSEGV (exit 139) when
drmGetVersion() returns NULL, while the patched version returns cleanly with
fixed_size_cursor == 0. The normal amdgpu case (64x64 cursor) still yields
fixed_size_cursor == 1. driver.c compiles clean under meson/ninja.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
adding a helper for calculating the offset of the first xWindowRoot
structure within the connection info block. this way getting rid
of the global connBlockScreenStart field.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Some amdgpu hardware (older ones, such as AMD Polaris 11 ) can only
render 64x64, 64x128 and 128x128 cursor. It doens't report any errors to
user space and only visual glitches on monitor visible.
This patch checks If drm driver reports any cursor side 64 or 128 - assume
hardware can only render 64x64 or 128x128 hw cursor planes
Fixes: https://gitlab.freedesktop.org/xorg/xserver/-/work_items/1922
Fixes: https://github.com/X11Libre/xserver/issues/1816
Signed-off-by: Tautvis <gtautvis@gmail.com>
inline CreateConnectionBlock() into PanoramiXCreateConnectionBlock(),
in order to make future refactoring a bit easier. Further steps will
refactor the function to just return the buffer instead of setting
global variables.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
When Xinerama is enabled, the number of user-visible roots (screens)
isn't equal to number of actual server screens anymore. Instead of
having #ifdef's in several places, let the connection block renderer
record the number of roots actually processed.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
We have to patch up the connection info block with per-client specific
data. Instead of patching up a global buffer, do this in a safe copy.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
When screen size change occours, we were patching individual fields
in the connection info block directly. That's an ugly violation of
layers and causing direct dependency on DIX internal data structures.
Since those events are really rare, better trigger fresh creation
of the connection info block as a whole, instead of peeking into
the details our own.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Factor out the actual rendering to a separate function, which now just
returns x_rpcbuf_t, not directly updating global ConnectionInfo field
(that's left to the caller).
In later iterations, we then could easily generate a new connection info
block per client, eg. masking the available screens based on separate
policies (NEXUS screen remapping, Xnamespace permissions, etc).
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Simplify the code by using x_rpcbuf_t, so we don't need prio block size
calculation and care for allocation / reallocation. rpcbuf is don't it
all for us and giving us the final block size.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Drop the global connSetupPrefix variable and instead create that
tiny struct on the fly (we need to copy it for byteswapping anyways)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
a) replace custom callback machinery by standard CallbackListPtr
Dropping lots of unnecessarily duplicated code.
b) call the callbacks from PanoramiXConsolidate() instead of
PanoramiXCreateConnectionBlock()
Still called after Xinerama has been finished it's own setup (so Xv can do
it's xinerama-specific setups) and before the first client can connect.
But now we can re-call PanoramiXCreateConnectionBlock() any time.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
For now, the function is called only once, but upcoming changes
(NEXUS preparations) could change this, no we need some protection.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Store it it's own variable as authorative source, so we don't
need to keep it in connSetupPrefix anymore - and get rid of that
in future steps.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Make the code path a bit cleaner and tightly more efficient
(by doing the byteswap directly)
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Remove dependency on MIN() from os/mathx_priv.h by replacing the MIN()
call with an explicit bounds check using ternary-style logic.
Changes:
- Change walkStop from int to unsigned (consistency with walkScreenIdx)
- Replace MIN(start + num, screenInfo.numScreens) with explicit check
- Update doc comment to accurately describe 'start + num limited by
screenInfo.numScreens' semantics instead of 'all screens'
- Fix typo 'poiner' -> 'pointer' in doc comment
This keeps the macro signature and behavior unchanged (#3725 uses it),
while making it self-contained without requiring os/mathx_priv.h.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Panoramix needs a special handling so that we're only sending one
screen (and numRoots becomes = 1). Instead of tweaking global
variables back and forth, just pass in the desired value.
When 0 is passed, using screenInfo.numScreens instead.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Special form of DIX_FOR_EACH_SCREEN() which is starting at some
given offset and walking only given number from here.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Usually, we would use screenInfo.numScreens, but Xinerama has a special
handling that's taking the number from the already compiled ConnectionInfo's
numRoots field.
Actually, we don't need any special handling here, just take the numroots
field, because in non-xinerama case, it's equal to screenInfo.numScreens.
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>