xserver: Branch 'xwayland-24.1' - 23 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Sep 25 12:27:44 UTC 2024
.gitlab-ci.yml | 2 -
.gitlab-ci/debian-install.sh | 2 -
Xi/xichangehierarchy.c | 33 +++++++++++++++++++++++++-----
dix/colormap.c | 1
dix/devices.c | 7 ++++--
dix/dixfonts.c | 27 +++++++++++++------------
dix/enterleave.c | 7 ++++++
dix/eventconvert.c | 12 +++++++++++
dix/gc.c | 3 +-
dix/property.c | 45 ++++++++++++++++++++++++------------------
dix/ptrveloc.c | 1
dix/resource.c | 2 -
hw/xwayland/meson.build | 1
hw/xwayland/xwayland-output.c | 15 +++++++++++---
hw/xwayland/xwayland-screen.c | 12 +++++------
meson.build | 8 ++++++-
os/access.c | 6 +++--
os/client.c | 29 ++++++++++++++++-----------
present/meson.build | 6 -----
19 files changed, 146 insertions(+), 73 deletions(-)
New commits:
commit 0713e7e3824ff897c333c74ded5c51c8a66ea57d
Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date: Thu Aug 15 13:23:10 2024 -0400
xwayland: connect to the wl display before calling into EGL
using EGL (e.g., eglQueryString, epoxy_has_egl_extension)
before establishing this connection
enables the GBM/EGL implementation to potentially consume the
WAYLAND_SOCKET fd, which, if closed, will cause the compositor
to kill this xserver
(cherry picked from commit ff8ec59c97053b3fadaed635120665577fd7a43b)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index 4b575667a..822e55bf3 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -978,6 +978,12 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
return FALSE;
}
+ xwl_screen->display = wl_display_connect(NULL);
+ if (xwl_screen->display == NULL) {
+ ErrorF("could not connect to wayland server\n");
+ return FALSE;
+ }
+
#ifdef XWL_HAS_GLAMOR
if (xwl_screen->glamor && !xwl_glamor_init_gbm(xwl_screen)) {
ErrorF("xwayland glamor: failed to setup GBM backend, falling back to sw accel\n");
@@ -1006,12 +1012,6 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
if (!monitorResolution)
monitorResolution = DEFAULT_DPI;
- xwl_screen->display = wl_display_connect(NULL);
- if (xwl_screen->display == NULL) {
- ErrorF("could not connect to wayland server\n");
- return FALSE;
- }
-
if (use_fixed_size) {
if (!xwl_screen_init_randr_fixed(xwl_screen))
return FALSE;
commit 8d9b8249a7d2c489c84db9650a2140f2d97dd853
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Mon Sep 23 09:27:21 2024 +0200
os: Fix NULL pointer dereference
RemoveHost() can be called from DisableLocalHost() with a NULL client,
but doesn't actually check whether the given client pointer is valid on
error and assigns the error value unconditionally, leading to a possible
NULL pointer dereference and a crash of the Xserver.
To avoid the issue, simply check whether the client pointer is not NULL
prior to assign the errorValue.
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1752
See-also: https://bugzilla.redhat.com/2313799
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
(cherry picked from commit 57a446c0f98693bd2e0263e91213344d870f4e03)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/os/access.c b/os/access.c
index 08a99bda4..485f6a5c3 100644
--- a/os/access.c
+++ b/os/access.c
@@ -1438,13 +1438,15 @@ RemoveHost(ClientPtr client, int family, unsigned length, /* of bytes in p
case FamilyChaos:
case FamilyServerInterpreted:
if ((len = CheckAddr(family, pAddr, length)) < 0) {
- client->errorValue = length;
+ if (client)
+ client->errorValue = length;
return BadValue;
}
break;
case FamilyLocal:
default:
- client->errorValue = family;
+ if (client)
+ client->errorValue = family;
return BadValue;
}
for (prev = &validhosts;
commit 02546fa66a568ffb9acdc76445e27246fd469b74
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sat Sep 7 15:06:03 2024 -0700
CI: update libdecor from 0.1.0 to 0.1.1
The install_demo meson_option was added in
libdecor/libdecor at 7106f5e32986e2773df8199a194b152a2a2c0cab
which is in the 0.1.1 tag, but not 0.1.0.
If we upgrade the version of meson used in the CI to 1.0.0, then it fails
to build libdecor 0.1.0 with: ERROR: Unknown options: "install_demo"
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 32adf434b7138dc3f11358d164d55333706a4873)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b2e2a8942..0a2d0473e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -19,7 +19,7 @@ variables:
FDO_UPSTREAM_REPO: xorg/xserver
FDO_DISTRIBUTION_VERSION: bullseye-slim
FDO_DISTRIBUTION_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/debian-install.sh'
- FDO_DISTRIBUTION_TAG: "2024-04-11-no-xorg"
+ FDO_DISTRIBUTION_TAG: "2024-09-24-no-xorg"
MESON_BUILDDIR: "build"
include:
diff --git a/.gitlab-ci/debian-install.sh b/.gitlab-ci/debian-install.sh
index b3f06af35..41545ec8f 100644
--- a/.gitlab-ci/debian-install.sh
+++ b/.gitlab-ci/debian-install.sh
@@ -154,7 +154,7 @@ cd ..
rm -rf wayland-protocols
# Install libdecor for Xwayland
-git clone https://gitlab.freedesktop.org/libdecor/libdecor.git --depth 1 --branch=0.1.0
+git clone https://gitlab.freedesktop.org/libdecor/libdecor.git --depth 1 --branch=0.1.1
cd libdecor
meson _build -D{demo,install_demo}=false
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
commit e4d9cbf0e9f13b69898168bda1ceeed5756e77d2
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sat Sep 7 15:03:06 2024 -0700
CI: clone libdecor from fd.o instead of gnome.org
https://gitlab.gnome.org/jadahl/libdecor is archived and the README
says to use https://gitlab.freedesktop.org/libdecor/libdecor instead.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit fc8ba2441326dae03d7c223537430f860f061f81)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/.gitlab-ci/debian-install.sh b/.gitlab-ci/debian-install.sh
index 7f9e22a7d..b3f06af35 100644
--- a/.gitlab-ci/debian-install.sh
+++ b/.gitlab-ci/debian-install.sh
@@ -154,7 +154,7 @@ cd ..
rm -rf wayland-protocols
# Install libdecor for Xwayland
-git clone https://gitlab.gnome.org/jadahl/libdecor.git --depth 1 --branch=0.1.0
+git clone https://gitlab.freedesktop.org/libdecor/libdecor.git --depth 1 --branch=0.1.0
cd libdecor
meson _build -D{demo,install_demo}=false
ninja -C _build -j${FDO_CI_CONCURRENT:-4} install
commit 5d84e4779bf221c86bb3e6f92f60ba437bcbf63c
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 13:27:45 2024 -0700
dix: FindBestPixel: fix implicit fallthrough warning
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 9c9e1afeb277030380daa9b22f88b05e1af783a0)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/colormap.c b/dix/colormap.c
index 7a00d14d6..b5b34d656 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -1250,6 +1250,7 @@ FindBestPixel(EntryPtr pentFirst, int size, xrgb * prgb, int channel)
case PSEUDOMAP:
dg = (long) pent->co.local.green - prgb->green;
db = (long) pent->co.local.blue - prgb->blue;
+ /* fallthrough */
case REDMAP:
dr = (long) pent->co.local.red - prgb->red;
break;
commit 2d5494ebbb3ba684b06d4c6bb4f75b5b23ba4891
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 13:21:14 2024 -0700
dix: GetPairedDevice: check if GetMaster returned NULL
Clears warning from gcc 14.1:
../dix/devices.c: In function ‘GetPairedDevice’:
../dix/devices.c:2734:15: warning: dereference of NULL ‘dev’
[CWE-476] [-Wanalyzer-null-dereference]
2734 | return dev->spriteInfo? dev->spriteInfo->paired: NULL;
| ~~~^~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit e6fc0861d8016ab31536329acac6d6de4bc64164)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/devices.c b/dix/devices.c
index edaf000d6..6e27e3e2e 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2731,7 +2731,7 @@ GetPairedDevice(DeviceIntPtr dev)
if (!IsMaster(dev) && !IsFloating(dev))
dev = GetMaster(dev, MASTER_ATTACHED);
- return dev->spriteInfo? dev->spriteInfo->paired: NULL;
+ return (dev && dev->spriteInfo) ? dev->spriteInfo->paired: NULL;
}
/**
commit cfda3969a1dc82c3aa24a8f5b7813cf0510a7455
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 11:59:07 2024 -0700
dix: HashResourceID: use unsigned integers for bit shifting
Clears warning from gcc 14.1:
../dix/resource.c: In function ‘HashResourceID’:
../dix/resource.c:691:44: warning: left shift of negative value
[-Wshift-negative-value]
691 | return (id ^ (id >> numBits)) & ~((~0) << numBits);
| ^~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 26a7ab09eae24fda6cbf51e03f974c7572e80e69)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/resource.c b/dix/resource.c
index f8be25c2c..9fae20805 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -685,7 +685,7 @@ HashResourceID(XID id, unsigned int numBits)
id &= mask;
if (numBits < 9)
return (id ^ (id >> numBits) ^ (id >> (numBits<<1))) & ~((~0U) << numBits);
- return (id ^ (id >> numBits)) & ~((~0) << numBits);
+ return (id ^ (id >> numBits)) & ~((~0U) << numBits);
}
static XID
commit 4335bdeb013762e0cfcf98892929b00d8cdbc579
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 11:15:03 2024 -0700
dix: ProcListProperties: skip unneeded work if numProps is 0
No real harm, but clears warning from gcc 14.1:
../dix/property.c: In function ‘ProcListProperties’:
..//dix/property.c:605:27: warning: dereference of NULL ‘temppAtoms’
[CWE-476] [-Wanalyzer-null-dereference]
605 | *temppAtoms++ = pProp->propertyName;
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 39f337fd497d6fd95efaae9ff5a62d60b49e16aa)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/property.c b/dix/property.c
index f7f9d0943..3eca8615a 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -589,17 +589,20 @@ ProcListProperties(ClientPtr client)
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
numProps++;
- if (numProps && !(pAtoms = xallocarray(numProps, sizeof(Atom))))
- return BadAlloc;
-
- numProps = 0;
- temppAtoms = pAtoms;
- for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
- realProp = pProp;
- rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess);
- if (rc == Success && realProp == pProp) {
- *temppAtoms++ = pProp->propertyName;
- numProps++;
+ if (numProps) {
+ pAtoms = xallocarray(numProps, sizeof(Atom));
+ if (!pAtoms)
+ return BadAlloc;
+
+ numProps = 0;
+ temppAtoms = pAtoms;
+ for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
+ realProp = pProp;
+ rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess);
+ if (rc == Success && realProp == pProp) {
+ *temppAtoms++ = pProp->propertyName;
+ numProps++;
+ }
}
}
@@ -613,8 +616,8 @@ ProcListProperties(ClientPtr client)
if (numProps) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
+ free(pAtoms);
}
- free(pAtoms);
return Success;
}
commit 6d384ab8bf4027a27d322e5b984657a024ad7278
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 11:03:41 2024 -0700
dix: dixChangeWindowProperty: don't call memcpy if malloc failed
It shouldn't matter, since it would have a length of 0, but it
clears warnings from gcc 14.1:
../dix/property.c: In function ‘dixChangeWindowProperty’:
../dix/property.c:287:9: warning: use of possibly-NULL ‘data’ where
non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
287 | memcpy(data, value, totalSize);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../dix/property.c:324:13: warning: use of possibly-NULL ‘data’ where
non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
324 | memcpy(data, value, totalSize);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 10cafd0bbebfbb92c4e73088ba168ef96fcb983c)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/property.c b/dix/property.c
index acce94b2c..f7f9d0943 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -276,11 +276,13 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
if (!pProp)
return BadAlloc;
data = malloc(totalSize);
- if (!data && len) {
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
- return BadAlloc;
+ if (totalSize) {
+ if (!data) {
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ return BadAlloc;
+ }
+ memcpy(data, value, totalSize);
}
- memcpy(data, value, totalSize);
pProp->propertyName = property;
pProp->type = type;
pProp->format = format;
@@ -313,9 +315,11 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
if (mode == PropModeReplace) {
data = malloc(totalSize);
- if (!data && len)
- return BadAlloc;
- memcpy(data, value, totalSize);
+ if (totalSize) {
+ if (!data)
+ return BadAlloc;
+ memcpy(data, value, totalSize);
+ }
pProp->data = data;
pProp->size = len;
pProp->type = type;
commit fc7b6c75498ab72b2a268cf21da4cb23eb0ed9f7
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 10:41:33 2024 -0700
dix: InitPredictableAccelerationScheme: avoid memory leak on failure
Clears warning from gcc 14.1:
../dix/ptrveloc.c: In function ‘InitPredictableAccelerationScheme’:
../dix/ptrveloc.c:149:9: warning: leak of ‘<unknown>’
[CWE-401] [-Wanalyzer-malloc-leak]
149 | free(vel);
| ^~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 462d13c2f6dc25adea1f19e6b621f97b997236af)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index 5166288e8..ee5a24c9e 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -146,6 +146,7 @@ InitPredictableAccelerationScheme(DeviceIntPtr dev,
schemeData->vel = vel;
scheme.accelData = schemeData;
if (!InitializePredictableAccelerationProperties(dev, vel, schemeData)) {
+ FreeVelocityData(vel);
free(vel);
free(schemeData);
return FALSE;
commit 83033ce108816faf4f981029af39261699d06906
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 10:03:08 2024 -0700
dix: CreateScratchGC: avoid dereference of pointer we just set to NULL
Clears warning from gcc 14.1:
../dix/gc.c: In function ‘CreateScratchGC’:
../dix/gc.c:818:28: warning: dereference of NULL ‘pGC’
[CWE-476] [-Wanalyzer-null-dereference]
818 | pGC->graphicsExposures = FALSE;
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 7ee3a520184b355820923bc7a955d0834eb8afbd)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/gc.c b/dix/gc.c
index 0e75e8765..47bab00bd 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -813,7 +813,8 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
FreeGC(pGC, (XID) 0);
pGC = (GCPtr) NULL;
}
- pGC->graphicsExposures = FALSE;
+ else
+ pGC->graphicsExposures = FALSE;
return pGC;
}
commit 44d1b7e4c11f467c9c1d7f79dcadb6dacc956939
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 09:57:36 2024 -0700
dix: enterleave.c: fix implicit fallthrough warnings
Clears 7 -Wimplicit-fallthrough warnings from gcc 14.1
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 0cb826e3d0fd366914c34ab18e5917930f6695b4)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/enterleave.c b/dix/enterleave.c
index 6d1c24adc..236a9e218 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -622,14 +622,19 @@ FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v,
switch (ev->num_valuators) {
case 6:
ev->valuator5 = v->axisVal[first + 5];
+ /* fallthrough */
case 5:
ev->valuator4 = v->axisVal[first + 4];
+ /* fallthrough */
case 4:
ev->valuator3 = v->axisVal[first + 3];
+ /* fallthrough */
case 3:
ev->valuator2 = v->axisVal[first + 2];
+ /* fallthrough */
case 2:
ev->valuator1 = v->axisVal[first + 1];
+ /* fallthrough */
case 1:
ev->valuator0 = v->axisVal[first];
break;
@@ -668,8 +673,10 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
switch (ev->num_valuators) {
case 3:
ev->valuator2 = v->axisVal[first + 2];
+ /* fallthrough */
case 2:
ev->valuator1 = v->axisVal[first + 1];
+ /* fallthrough */
case 1:
ev->valuator0 = v->axisVal[first];
break;
commit 013311852d8ea6df017eca35615e850aa1927d2f
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 09:45:54 2024 -0700
dix: SetFontPath: don't set errorValue on Success
Clears warning from gcc 14.1:
../dix/dixfonts.c: In function ‘SetFontPath’:
../dix/dixfonts.c:1697:28: warning: use of uninitialized value ‘bad’
[CWE-457] [-Wanalyzer-use-of-uninitialized-value]
1697 | client->errorValue = bad;
| ~~~~~~~~~~~~~~~~~~~^~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 1a86fba0d9ae2e107e3ed23519ab3b84d2e5240e)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 149ab273e..f8dc5ff9b 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1687,7 +1687,8 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths)
int bad;
err = SetFontPathElements(npaths, paths, &bad, FALSE);
- client->errorValue = bad;
+ if (err != Success)
+ client->errorValue = bad;
}
return err;
}
commit 2f1ea65b6de4323cbf4cf537b82987ef9461f4e5
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 09:28:19 2024 -0700
dix: PolyText: fully initialize local_closure
Clears warning from gcc 14.1:
../dix/dixfonts.c:1352:15: warning: use of uninitialized value ‘*c.data’
[CWE-457] [-Wanalyzer-use-of-uninitialized-value]
1352 | free(c->data);
| ~^~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit d78836a3a6b827a282957c48898f9ba4cb0dbcf5)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 9608e4b1f..149ab273e 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1352,18 +1352,18 @@ int
PolyText(ClientPtr client, DrawablePtr pDraw, GC * pGC, unsigned char *pElt,
unsigned char *endReq, int xorg, int yorg, int reqType, XID did)
{
- PTclosureRec local_closure;
-
- local_closure.pElt = pElt;
- local_closure.endReq = endReq;
- local_closure.client = client;
- local_closure.pDraw = pDraw;
- local_closure.xorg = xorg;
- local_closure.yorg = yorg;
- local_closure.reqType = reqType;
- local_closure.pGC = pGC;
- local_closure.did = did;
- local_closure.err = Success;
+ PTclosureRec local_closure = {
+ .client = client,
+ .pDraw = pDraw,
+ .pGC = pGC,
+ .pElt = pElt,
+ .endReq = endReq,
+ .xorg = xorg,
+ .yorg = yorg,
+ .reqType = reqType,
+ .did = did,
+ .err = Success
+ };
(void) doPolyText(client, &local_closure);
return Success;
commit 0d1b7672e7bb357c675a4fa6962bd9c9f439ab82
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 09:17:17 2024 -0700
dix: check for calloc() failure in Xi event conversion routines
Clears up 12 -Wanalyzer-possible-null-dereference warnings from gcc 14.1
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 25762834c9a5da3a7c672d89a7da73297252d905)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 30cf86f0a..ac1472290 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -684,6 +684,8 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
len += vallen * 4; /* valuators mask */
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
xde = (xXIDeviceEvent *) * xi;
xde->type = GenericEvent;
xde->extension = IReqCode;
@@ -752,6 +754,8 @@ eventToTouchOwnershipEvent(TouchOwnershipEvent *ev, xEvent **xi)
xXITouchOwnershipEvent *xtoe;
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
xtoe = (xXITouchOwnershipEvent *) * xi;
xtoe->type = GenericEvent;
xtoe->extension = IReqCode;
@@ -782,6 +786,8 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
len += vallen * 4; /* valuators mask */
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
raw = (xXIRawEvent *) * xi;
raw->type = GenericEvent;
raw->extension = IReqCode;
@@ -817,6 +823,8 @@ eventToBarrierEvent(BarrierEvent *ev, xEvent **xi)
int len = sizeof(xXIBarrierEvent);
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
barrier = (xXIBarrierEvent*) *xi;
barrier->type = GenericEvent;
barrier->extension = IReqCode;
@@ -846,6 +854,8 @@ eventToGesturePinchEvent(GestureEvent *ev, xEvent **xi)
xXIGesturePinchEvent *xpe;
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
xpe = (xXIGesturePinchEvent *) * xi;
xpe->type = GenericEvent;
xpe->extension = IReqCode;
@@ -888,6 +898,8 @@ eventToGestureSwipeEvent(GestureEvent *ev, xEvent **xi)
xXIGestureSwipeEvent *xde;
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
xde = (xXIGestureSwipeEvent *) * xi;
xde->type = GenericEvent;
xde->extension = IReqCode;
commit a73fb98dc3e8fc784c0e934597fc1d765104de25
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Aug 13 10:22:35 2024 +0200
build: Fix DRI3 on DragonFly and OpenBSD
Commit 96bdc156 added a check for <sys/eventfd.h> to enable DRI3.
DragonFly and OpenBSD however rely on epoll-shim for <sys/eventfd.h>,
so that must be added as a dependency for the <sys/eventfd.h> check.
Fixes: commit 96bdc156 - xwayland: Do not enable DRI3 without eventfd
Suggested-by: Jan Beich <jbeich at freebsd.org>
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
(cherry picked from commit 8fe15a60c5e4e1950594309fd343354ebeddc4ae)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/meson.build b/meson.build
index 58ec3d6a0..d874fe81e 100644
--- a/meson.build
+++ b/meson.build
@@ -338,7 +338,7 @@ else
epoll_dep = []
endif
-have_eventfd = cc.has_header('sys/eventfd.h')
+have_eventfd = cc.has_header('sys/eventfd.h', dependencies: epoll_dep)
if get_option('dri3') == 'auto'
build_dri3 = dri3proto_dep.found() and xshmfence_dep.found() and libdrm_dep.found() and have_eventfd
else
commit 98fb1d48c42743a05cdd4feffbddd96095e4b256
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Aug 13 10:29:33 2024 +0200
build: Add epoll to Xwayland for DragonFly and OpenBSD
DragonFly and OpenBSD rely on epoll-shim for <sys/eventfd>, add a
optional dependency to build Xwayland.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
(cherry picked from commit 7bcf2bcafc7bf2ec0d089687e5d6291df816e0c6)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 337b7409a..a89753d44 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -146,6 +146,7 @@ xwayland_server = executable(
include_directories: wayland_inc,
dependencies: [
common_dep,
+ epoll_dep,
xwayland_dep,
xwaylandproto_dep,
],
commit b701969331b00f5cf6645d09ef3f532313f36e6a
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Tue Aug 13 10:18:38 2024 +0200
build: Move epoll dependency check
DragonFly and OpenBSD rely on epoll-shim to provide eventfd.
Move the check for epoll dependency to the root meson.build script so
that we can use that for the <sys/evenfd.h> check as well.
This is preparation work for the following commits, no functional change
intended at this point.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
(cherry picked from commit 673b56e61c9c80d8484128827bd51b26d3120a3f)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/meson.build b/meson.build
index c1bc0e469..58ec3d6a0 100644
--- a/meson.build
+++ b/meson.build
@@ -332,6 +332,12 @@ endif
libdrm_dep = dependency('libdrm', version: libdrm_req, required: false)
+if host_machine.system() in ['freebsd', 'openbsd']
+ epoll_dep = dependency('epoll-shim')
+else
+ epoll_dep = []
+endif
+
have_eventfd = cc.has_header('sys/eventfd.h')
if get_option('dri3') == 'auto'
build_dri3 = dri3proto_dep.found() and xshmfence_dep.found() and libdrm_dep.found() and have_eventfd
diff --git a/present/meson.build b/present/meson.build
index faeac3074..17a4007d8 100644
--- a/present/meson.build
+++ b/present/meson.build
@@ -16,12 +16,6 @@ hdrs_present = [
'presentext.h',
]
-if host_machine.system() in ['freebsd', 'openbsd']
- epoll_dep = dependency('epoll-shim')
-else
- epoll_dep = []
-endif
-
libxserver_present = static_library('libxserver_present',
srcs_present,
include_directories: inc,
commit 16645b410df1ef6a92d6a88ba79030b1251c6bbb
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Jan 30 11:11:54 2024 +1000
Xi: when removing a master search for a disabled paired device
If either the master pointer or keyboard was disabled, the respective
GetMaster() call returns NULL, causing a segfault later accessing the
deviceid.
Fix this by looking in the off_devices list for any master
device of the type we're looking for. Master devices lose the pairing
when disabled (on enabling a keyboard we simply pair with the first
available unpaired pointer).
And for readability, split the device we get from the protocol request
into a new "dev" variable instead of re-using ptr.
Fixes #1611
(cherry picked from commit e7c876ab0b0daa546a23d4ef82537fdf8fd88e04)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 72d00451e..d8aaf95cb 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -46,6 +46,7 @@
#include "exevents.h"
#include "exglobals.h"
#include "geext.h"
+#include "misc.h"
#include "xace.h"
#include "xiquerydevice.h" /* for GetDeviceUse */
@@ -215,36 +216,56 @@ disable_clientpointer(DeviceIntPtr dev)
}
}
+static DeviceIntPtr
+find_disabled_master(int type)
+{
+ DeviceIntPtr dev;
+
+ /* Once a master device is disabled it loses the pairing, so returning the first
+ * match is good enough */
+ for (dev = inputInfo.off_devices; dev; dev = dev->next) {
+ if (dev->type == type)
+ return dev;
+ }
+
+ return NULL;
+}
+
static int
remove_master(ClientPtr client, xXIRemoveMasterInfo * r, int flags[MAXDEVICES])
{
- DeviceIntPtr ptr, keybd, XTestptr, XTestkeybd;
+ DeviceIntPtr dev, ptr, keybd, XTestptr, XTestkeybd;
int rc = Success;
if (r->return_mode != XIAttachToMaster && r->return_mode != XIFloating)
return BadValue;
- rc = dixLookupDevice(&ptr, r->deviceid, client, DixDestroyAccess);
+ rc = dixLookupDevice(&dev, r->deviceid, client, DixDestroyAccess);
if (rc != Success)
goto unwind;
- if (!IsMaster(ptr)) {
+ if (!IsMaster(dev)) {
client->errorValue = r->deviceid;
rc = BadDevice;
goto unwind;
}
/* XXX: For now, don't allow removal of VCP, VCK */
- if (ptr == inputInfo.pointer ||ptr == inputInfo.keyboard) {
+ if (dev == inputInfo.pointer || dev == inputInfo.keyboard) {
rc = BadDevice;
goto unwind;
}
- ptr = GetMaster(ptr, MASTER_POINTER);
+ if ((ptr = GetMaster(dev, MASTER_POINTER)) == NULL)
+ ptr = find_disabled_master(MASTER_POINTER);
+ BUG_RETURN_VAL(ptr == NULL, BadDevice);
rc = dixLookupDevice(&ptr, ptr->id, client, DixDestroyAccess);
if (rc != Success)
goto unwind;
- keybd = GetMaster(ptr, MASTER_KEYBOARD);
+
+ if ((keybd = GetMaster(dev, MASTER_KEYBOARD)) == NULL)
+ keybd = find_disabled_master(MASTER_KEYBOARD);
+ BUG_RETURN_VAL(keybd == NULL, BadDevice);
rc = dixLookupDevice(&keybd, keybd->id, client, DixDestroyAccess);
if (rc != Success)
goto unwind;
commit 13cfe2ec852d04aae8f89fb9c405ed314b93fb88
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Tue Jan 30 10:44:58 2024 +1000
dix: don't push the XKB state to a non-existing master keyboard
If our master keyboard is disabled, GetMaster() returns NULL and
we segfault in XkbPushLockedStateToSlaves().
Fixes 45fb3a934dc0db51584aba37c2f9d73deff9191d
Fixes #1611
(cherry picked from commit 9b983fecf999b9f50946973f2379a5ce00491cad)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/dix/devices.c b/dix/devices.c
index 0011be77c..edaf000d6 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2699,11 +2699,14 @@ AttachDevice(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr master)
dev->spriteInfo->paired = dev;
}
else {
+ DeviceIntPtr keyboard = GetMaster(dev, MASTER_KEYBOARD);
+
dev->spriteInfo->sprite = master->spriteInfo->sprite;
dev->spriteInfo->paired = master;
dev->spriteInfo->spriteOwner = FALSE;
- XkbPushLockedStateToSlaves(GetMaster(dev, MASTER_KEYBOARD), 0, 0);
+ if (keyboard)
+ XkbPushLockedStateToSlaves(keyboard, 0, 0);
RecalculateMasterButtons(master);
}
commit 11d0f4f19d52d6f080836c358afa52a89414cdcb
Author: Matthieu Herrb <matthieu at herrb.eu>
Date: Sat Feb 17 16:47:38 2024 +0100
Return NULL in *cmdname if the client argv or argv[0] is NULL
(cherry picked from commit 59f5445a7ff3ee1468d86f03943c976c790c0893)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/os/client.c b/os/client.c
index 8aa924959..c6ca0f2fa 100644
--- a/os/client.c
+++ b/os/client.c
@@ -324,10 +324,9 @@ DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
return;
argv = kvm_getargv(kd, kp, 0);
if (cmdname) {
- if (argv == NULL || argv[0] == NULL) {
- *cmdname = strdup("");
+ if (argv == NULL || argv[0] == NULL)
return;
- } else
+ else
*cmdname = strdup(argv[0]);
}
if (cmdargs) {
commit e50ea9181a7eb2203b86ffbb71c6696fa034df1f
Author: Matthieu Herrb <matthieu at herrb.eu>
Date: Fri Nov 11 14:58:02 2022 +0100
Don't crash if the client argv or argv[0] is NULL.
Report from bauerm at pestilenz dot org.
(cherry picked from commit a8512146ba9f475a384a35337f51c7730ba7b4ce)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/os/client.c b/os/client.c
index 3295949a4..8aa924959 100644
--- a/os/client.c
+++ b/os/client.c
@@ -323,18 +323,26 @@ DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs)
if (n != 1)
return;
argv = kvm_getargv(kd, kp, 0);
- *cmdname = strdup(argv[0]);
- i = 1;
- while (argv[i] != NULL) {
- len += strlen(argv[i]) + 1;
- i++;
+ if (cmdname) {
+ if (argv == NULL || argv[0] == NULL) {
+ *cmdname = strdup("");
+ return;
+ } else
+ *cmdname = strdup(argv[0]);
}
- *cmdargs = calloc(1, len);
- i = 1;
- while (argv[i] != NULL) {
- strlcat(*cmdargs, argv[i], len);
- strlcat(*cmdargs, " ", len);
- i++;
+ if (cmdargs) {
+ i = 1;
+ while (argv[i] != NULL) {
+ len += strlen(argv[i]) + 1;
+ i++;
+ }
+ *cmdargs = calloc(1, len);
+ i = 1;
+ while (argv[i] != NULL) {
+ strlcat(*(char **)cmdargs, argv[i], len);
+ strlcat(*(char **)cmdargs, " ", len);
+ i++;
+ }
}
kvm_close(kd);
}
commit fa70fdf961e226a2b2e6dffe22aa60b4140d63e7
Author: Olivier Fourdan <ofourdan at redhat.com>
Date: Thu Aug 8 10:07:27 2024 +0200
xwayland: Report correct mode size when rootful
The vidmode extension emulation in Xwayland reports the modeline based
on the current mode.
To do so, it searches for the mode using `xwl_output_find_mode(-1, -1)`
which is supposed to return the current mode, whatever that mode is.
With XRandR emulation, in rootless mode, the default value is the mode
at index 0. That assumption, however is not true when running rootful.
That means that the vidmode extension will always return the highest
mode available, which is 5120x2880, with Xwayland running rootful:
$ xwayland-run -geometry 1024x768 -- xvidtune -show
"5120x2880" 1276.50 5120 5560 6128 7136 2880 2883 2888 2982 -hsync +vsync
Luckily, when Xwayland is running rootful, we have the current mode size
conveniently stored in dedicated fields of the xwayland output struct,
so we can use that to search for the right mode being used and report
that through the vidmode extension:
$ xwayland-run -geometry 1024x768 -- xvidtune -show
"1024x768" 63.50 1024 1064 1176 1328 768 771 775 798 -hsync +vsync
That fixes legacy games using the vidmode extension and rendering at the
wrong size when running within Xwayland rootful.
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
(cherry picked from commit e2e5842444c20ab57cfc74cf0c0cdeb021afbc8a)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1702>
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index f75591500..794a9aa7a 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -402,9 +402,18 @@ xwl_output_find_mode(struct xwl_output *xwl_output,
RROutputPtr output = xwl_output->randr_output;
int i;
- /* width & height -1 means we want the actual output mode, which is idx 0 */
- if (width == -1 && height == -1 && output->modes)
- return output->modes[0];
+ /* width & height -1 means we want the actual output mode */
+ if (width == -1 && height == -1) {
+ if (xwl_output->mode_width > 0 && xwl_output->mode_height > 0) {
+ /* If running rootful, use the current mode size to search for the mode */
+ width = xwl_output->mode_width;
+ height = xwl_output->mode_height;
+ }
+ else if (output->modes) {
+ /* else return the mode at first idx 0 */
+ return output->modes[0];
+ }
+ }
for (i = 0; i < output->numModes; i++) {
if (output->modes[i]->mode.width == width && output->modes[i]->mode.height == height)
More information about the xorg-commit
mailing list