Commit graph

19695 commits

Author SHA1 Message Date
kohnish
5bd03e1824 Revert "mi: make miRecolorCursor() static"
This reverts commit 6dbb957922.
2025-12-03 17:43:35 +00:00
kohnish
859e4282d4 Revert "mi: make CopyGetMasterEvent() static"
This reverts commit 12c507cd1f.
2025-12-03 17:43:35 +00:00
kohnish
08f3e93502 Revert "mi: unexport miWideArc()"
This reverts commit aaaa0a35e5.
2025-12-03 17:43:35 +00:00
kohnish
0afa60c22c Revert "mi: unexport miStepDash()"
This reverts commit 8a6bbc80f3.
2025-12-03 17:43:35 +00:00
kohnish
6d8dbe3db8 Revert "mi: unexport mieqInit()"
This reverts commit 5ac361cce9.
2025-12-03 17:43:35 +00:00
kohnish
78f41e3db6 Revert "mi: unexport mieqFini()"
This reverts commit 4742790351.
2025-12-03 17:43:35 +00:00
kohnish
c2914634c4 Revert "mi: unexport mieqEnqueue()"
This reverts commit 9dd280607f.
2025-12-03 17:43:35 +00:00
kohnish
df69bf6b31 Revert "mi: unexport mieqSwitchScreen()"
This reverts commit 413e6ed2c8.
2025-12-03 17:43:35 +00:00
kohnish
a7dd684057 Revert "mi: unexport mieqProcessDeviceEvent()"
This reverts commit 0f7770bce3.
2025-12-03 17:43:35 +00:00
kohnish
fc562444bc Revert "mi: unexport mieqProcessInputEvents()"
This reverts commit 9aa23b6abd.
2025-12-03 17:43:35 +00:00
kohnish
15fac1a168 Revert "mi: unexport mieqAddCallbackOnDrained()"
This reverts commit 269d54c48f.
2025-12-03 17:43:35 +00:00
kohnish
51e68e3951 Revert "mi: unexport mieqRemoveCallbackOnDrained()"
This reverts commit 964127ce10.
2025-12-03 17:43:35 +00:00
kohnish
5425489d33 Revert "mi: unexport mieqSetHandler()"
This reverts commit 7748984e3a.
2025-12-03 17:43:35 +00:00
kohnish
06c8dbd7ff Revert "mi: unexport miSendExposures()"
This reverts commit 8d07450904.
2025-12-03 17:43:35 +00:00
kohnish
a080a088b8 Revert "mi: unexport miWindowExposures()"
This reverts commit e424f49cdb.
2025-12-03 17:43:35 +00:00
kohnish
b982c9514c Revert "mi: unexport miPaintWindow()"
This reverts commit a54e8f5343.
2025-12-03 17:43:35 +00:00
kohnish
34f7357075 Revert "mi: unexport miSourceValidate()"
This reverts commit 191cca0905.
2025-12-03 17:43:35 +00:00
kohnish
a7b98cf156 Revert "mi: unexport miShapedWindowIn()"
This reverts commit c2ee74c523.
2025-12-03 17:43:35 +00:00
kohnish
b29d022512 Revert "mi: unexport miValidateTree()"
This reverts commit 7e21a514d7.
2025-12-03 17:43:35 +00:00
kohnish
f4ae013c8f Revert "mi: unexport miClearToBackground()"
This reverts commit 3856b6cb5e.
2025-12-03 17:43:35 +00:00
kohnish
1855037ac4 Revert "mi: unexport miMarkWindow()"
This reverts commit bcbb6eec62.
2025-12-03 17:43:35 +00:00
kohnish
b8b84c6090 Revert "mi: unexport miMarkOverlappedWindows()"
This reverts commit ade6650a81.
2025-12-03 17:43:35 +00:00
kohnish
390d17fd49 Revert "mi: unexport miHandleValidateExposures()"
This reverts commit 0624a8bad4.
2025-12-03 17:43:35 +00:00
kohnish
b301b5f212 Revert "mi: unexport miMoveWindow()"
This reverts commit faad8ed1c6.
2025-12-03 17:43:35 +00:00
kohnish
d775d4c22e Revert "mi: unexport miResizeWindow()"
This reverts commit 14565a4561.
2025-12-03 17:43:35 +00:00
kohnish
cd0908b1bb Revert "mi: unexport miGetLayerWindow()"
This reverts commit f11e203215.
2025-12-03 17:43:35 +00:00
kohnish
9e0151e64a Revert "mi: unexport miSetShape()"
This reverts commit 597ba690d3.
2025-12-03 17:43:35 +00:00
kohnish
a06fac4ac2 Revert "mi: unexport miChangeBorderWidth()"
This reverts commit b23ecec2f4.
2025-12-03 17:43:35 +00:00
kohnish
0ff8654221 Revert "mi: unexport miMarkUnrealizedWindow()"
This reverts commit 6c3b432053.
2025-12-03 17:43:35 +00:00
kohnish
876c053d52 Revert "mi: unexport miSpriteTrace()"
This reverts commit 85be6c82b0.
2025-12-03 17:43:35 +00:00
kohnish
c72b0add9b Revert "mi: unexport miXYToWindow()"
This reverts commit 3cf2408232.
2025-12-03 17:43:35 +00:00
kohnish
b07202abc7 Revert "mi: unexport SetInstalledmiColormap() macro"
This reverts commit aae9bd3f62.
2025-12-03 17:43:35 +00:00
stefan11111
eccee47185 glamor: fix Option "GlxVendorLibrary"
The old code tried to use a screen pointer that was uninitialized and set to NULL.
This caused it to segfault when this option was set.

When this option was used with the modesetting driver, `glamor_egl_init`
is called indirectly in the driver PreInit proc.

`xf86ScrnToScreen(scrn)` then returns NULL.

This patch moves setting the gl vendor later in the initialization process,
when we already have a non-null pScreen.

Minimal reproducer:
```
$ cat /etc/X11/xorg.conf.d/99-screen.conf
Section "Screen"
	Identifier "Default"
	Option "GlxVendorLibrary" "Name"
EndSection
```

Backtrace:
```
| #0  in abort ()
| #1  in OsAbort () at os/utils.c:1361
| #2  in AbortServer () at os/log.c:879
| #3  FatalError () at os/log.c:1017
| #4  in OsSigHandler () at os/osinit.c:156
| #5  OsSigHandler () at os/osinit.c:110
| #6  <signal handler called>
| #7  in __pthread_kill_implementation () from /lib64/libc.so.6
| #8  in raise () from /lib64/libc.so.6
| #9  in abort () from /lib64/libc.so.6
| #10 in __assert_fail_base.cold () from /lib64/libc.so.6
| #11 in xf86ScrnToScreen () at hw/xfree86/common/xf86Helper.c:1734
| #12 in glamor_egl_init () at glamor/glamor_egl.c:1108
| #13 in try_enable_glamor () at hw/xfree86/drivers/modesetting/driver.c:984
| #14 PreInit () at hw/xfree86/drivers/modesetting/driver.c:1211
| #15 in InitOutput () at hw/xfree86/common/xf86Init.c:478
| #16 in dix_main () at dix/main.c:190
| #17 main () at dix/stubmain.c:34
```

Fixes: a449bb4c5 - glamor_egl: add support of GlxVendorLibrary option

Signed-off-by: stefan11111 <stefan11111@shitposting.expert>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2096>
2025-11-27 10:28:03 +00:00
Alan Coopersmith
a5047d4a65 Create a SECURITY.md file
Provide information on where to report or learn of security bugs,
and what we do or do not consider to be a security bug.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2103>
2025-11-18 17:08:42 -08:00
kohnish
0060b91b49 Revert "dix: unexport dixLookupProperty()"
This reverts commit fb697dd644.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2101>
2025-11-17 21:33:26 +01:00
kohnish
9a4c322c4b Revert "dix: unexport DeleteAllWindowProperties()"
This reverts commit b0272692a1.

Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2101>
2025-11-17 21:33:26 +01:00
Alan Coopersmith
3e9baa20f3 glamor: avoid double free in glamor_make_pixmap_exportable()
Reported by gcc 15.1:

../glamor/glamor_egl.c:320:9:
 warning: double-‘free’ of ‘modifiers’ [CWE-415] [-Wanalyzer-double-free]
[...]
           │  732 |│        free(*modifiers);
           │      |│        ~~~~~~~~~~~~~~~~
           │      |│        |
           │      |└───────>(25) ...to here
           │      |         (26) first ‘free’ here
[...]
    │  320 |         free(modifiers);
    │      |         ~~~~~~~~~~~~~~~
    │      |         |
    │      |         (28) ⚠️  second ‘free’ here; first ‘free’ was at (26)

Fixes: cef12efc1 ("glamor: Implement GetSupportedModifiers")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-04 14:25:07 -08:00
Alan Coopersmith
6a4ec30af4 glamor: avoid null dereference in glamor_composite_clipped_region()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_render.c:1577:21:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-04 14:25:07 -08:00
Alan Coopersmith
c6522229b8 glamor: avoid null dereference in glamor_dash_setup()
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_dash.c:152:10:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-04 14:25:07 -08:00
Alan Coopersmith
84cf20e6dd glamor: handle allocation failures in glamor_largepixmap.c
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:130:17:
 warning[-Wanalyzer-possible-null-dereference]:
  dereference of possibly-NULL ‘clipped_regions’

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:235:13:
 warning[-Wanalyzer-possible-null-dereference]:
  dereference of possibly-NULL ‘result_regions’

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:365:9:
 warning[-Wanalyzer-possible-null-dereference]:
  dereference of possibly-NULL ‘clipped_regions’

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_largepixmap.c:1175:9:
 warning[-Wanalyzer-possible-null-dereference]:
  dereference of possibly-NULL ‘source_pixmap_priv’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-04 14:25:07 -08:00
Alan Coopersmith
a79bdc495e glamor: silence false positive in glamor_validate_gc()
We know that if gc->tileIsPixel is false, then gc->tile.pixmap must be
a valid pixmap, but gcc's static analyzer doesn't and needs to be told.

Silences false positive reported in #1817:

xwayland-24.1.6/redhat-linux-build/../glamor/glamor_core.c:205:19:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-02 11:52:32 -08:00
Alan Coopersmith
cc647f2367 glamor: handle allocation failure in glamor_create_pixmap()
Reported by gcc 15.1:

../glamor/glamor.c: In function ‘glamor_create_pixmap’:
../glamor/glamor.c:233:23: warning: potential null pointer dereference
 [-Wnull-dereference]
  233 |     pixmap_priv->type = GLAMOR_TEXTURE_ONLY;
      |     ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
../glamor/glamor.c:228:26: warning: potential null pointer dereference
 [-Wnull-dereference]
  228 |     pixmap_priv->is_cbcr = (GLAMOR_CREATE_FORMAT_CBCR & usage) == GLAMOR_CREATE_FORMAT_CBCR;

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-02 11:52:32 -08:00
Alan Coopersmith
69b48423bd glamor: handle potential NULL return from GetPictureScreenIfSet()
Unlike GetPictureScreen(), GetPictureScreenIfSet() checks if the
private key is registered, and returns NULL if it is not.

Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../glamor/glamor.c:926:5:
 warning[-Wanalyzer-null-dereference]: dereference of NULL ‘ps’

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2094>
2025-11-02 11:52:32 -08:00
Alan Coopersmith
f05f269f1d dri: prevent out-of-bounds read in dri3_fd_from_pixmap
Reported in #1817:

xwayland-24.1.6/redhat-linux-build/../dri3/dri3_screen.c:143:13:
 warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read
xwayland-24.1.6/redhat-linux-build/../dri3/dri3_screen.c:143:13:
 danger: out-of-bounds read from byte 16 till byte 19
 but ‘fds’ ends at byte 16
141|           int i;
142|           for (i = 0; i < num_fds; i++)
143|->             close(fds[i]);
144|           return -1;
145|       }

Only possible if fds_from_pixmap returns a value > 4, but the analyzer
doesn't know the interface is defined not to do that.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2085>
2025-11-01 21:55:42 +00:00
Olivier Fourdan
475d9f49ac xkb: Prevent overflow in XkbSetCompatMap()
The XkbCompatMap structure stores its "num_si" and "size_si" fields
using an unsigned short.

However, the function _XkbSetCompatMap() will store the sum of the
input data "firstSI" and "nSI" in both XkbCompatMap's "num_si" and
"size_si" without first checking if the sum overflows the maximum
unsigned short value, leading to a possible overflow.

To avoid the issue, check whether the sum does not exceed the maximum
unsigned short value, or return a "BadValue" error otherwise.

CVE-2025-62231, ZDI-CAN-27560

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2086>
2025-10-28 13:22:43 +01:00
Olivier Fourdan
10c94238bd xkb: Free the XKB resource when freeing XkbInterest
XkbRemoveResourceClient() would free the XkbInterest data associated
with the device, but not the resource associated with it.

As a result, when the client terminates, the resource delete function
gets called and accesses already freed memory:

 | Invalid read of size 8
 |   at 0x5BC0C0: XkbRemoveResourceClient (xkbEvents.c:1047)
 |   by 0x5B3391: XkbClientGone (xkb.c:7094)
 |   by 0x4DF138: doFreeResource (resource.c:890)
 |   by 0x4DFB50: FreeClientResources (resource.c:1156)
 |   by 0x4A9A59: CloseDownClient (dispatch.c:3550)
 |   by 0x5E0A53: ClientReady (connection.c:601)
 |   by 0x5E4FEF: ospoll_wait (ospoll.c:657)
 |   by 0x5DC834: WaitForSomething (WaitFor.c:206)
 |   by 0x4A1BA5: Dispatch (dispatch.c:491)
 |   by 0x4B0070: dix_main (main.c:277)
 |   by 0x4285E7: main (stubmain.c:34)
 | Address 0x1893e278 is 184 bytes inside a block of size 928 free'd
 |   at 0x4842E43: free (vg_replace_malloc.c:989)
 |   by 0x49C1A6: CloseDevice (devices.c:1067)
 |   by 0x49C522: CloseOneDevice (devices.c:1193)
 |   by 0x49C6E4: RemoveDevice (devices.c:1244)
 |   by 0x5873D4: remove_master (xichangehierarchy.c:348)
 |   by 0x587921: ProcXIChangeHierarchy (xichangehierarchy.c:504)
 |   by 0x579BF1: ProcIDispatch (extinit.c:390)
 |   by 0x4A1D85: Dispatch (dispatch.c:551)
 |   by 0x4B0070: dix_main (main.c:277)
 |   by 0x4285E7: main (stubmain.c:34)
 | Block was alloc'd at
 |   at 0x48473F3: calloc (vg_replace_malloc.c:1675)
 |   by 0x49A118: AddInputDevice (devices.c:262)
 |   by 0x4A0E58: AllocDevicePair (devices.c:2846)
 |   by 0x5866EE: add_master (xichangehierarchy.c:153)
 |   by 0x5878C2: ProcXIChangeHierarchy (xichangehierarchy.c:493)
 |   by 0x579BF1: ProcIDispatch (extinit.c:390)
 |   by 0x4A1D85: Dispatch (dispatch.c:551)
 |   by 0x4B0070: dix_main (main.c:277)
 |   by 0x4285E7: main (stubmain.c:34)

To avoid that issue, make sure to free the resources when freeing the
device XkbInterest data.

CVE-2025-62230, ZDI-CAN-27545

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2086>
2025-10-28 13:22:43 +01:00
Olivier Fourdan
99790a2c92 xkb: Make the RT_XKBCLIENT resource private
Currently, the resource in only available to the xkb.c source file.

In preparation for the next commit, to be able to free the resources
from XkbRemoveResourceClient(), make that variable private instead.

This is related to:

CVE-2025-62230, ZDI-CAN-27545

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2086>
2025-10-28 13:22:43 +01:00
Olivier Fourdan
5a4286b13f present: Fix use-after-free in present_create_notifies()
Using the Present extension, if an error occurs while processing and
adding the notifications after presenting a pixmap, the function
present_create_notifies() will clean up and remove the notifications
it added.

However, there are two different code paths that can lead to an error
creating the notify, one being before the notify is being added to the
list, and another one after the notify is added.

When the error occurs before it's been added, it removes the elements up
to the last added element, instead of the actual number of elements
which were added.

As a result, in case of error, as with an invalid window for example, it
leaves a dangling pointer to the last element, leading to a use after
free case later:

 |  Invalid write of size 8
 |     at 0x5361D5: present_clear_window_notifies (present_notify.c:42)
 |     by 0x534A56: present_destroy_window (present_screen.c:107)
 |     by 0x41E441: xwl_destroy_window (xwayland-window.c:1959)
 |     by 0x4F9EC9: compDestroyWindow (compwindow.c:622)
 |     by 0x51EAC4: damageDestroyWindow (damage.c:1592)
 |     by 0x4FDC29: DbeDestroyWindow (dbe.c:1291)
 |     by 0x4EAC55: FreeWindowResources (window.c:1023)
 |     by 0x4EAF59: DeleteWindow (window.c:1091)
 |     by 0x4DE59A: doFreeResource (resource.c:890)
 |     by 0x4DEFB2: FreeClientResources (resource.c:1156)
 |     by 0x4A9AFB: CloseDownClient (dispatch.c:3567)
 |     by 0x5DCC78: ClientReady (connection.c:603)
 |   Address 0x16126200 is 16 bytes inside a block of size 2,048 free'd
 |     at 0x4841E43: free (vg_replace_malloc.c:989)
 |     by 0x5363DD: present_destroy_notifies (present_notify.c:111)
 |     by 0x53638D: present_create_notifies (present_notify.c:100)
 |     by 0x5368E9: proc_present_pixmap_common (present_request.c:164)
 |     by 0x536A7D: proc_present_pixmap (present_request.c:189)
 |     by 0x536FA9: proc_present_dispatch (present_request.c:337)
 |     by 0x4A1E4E: Dispatch (dispatch.c:561)
 |     by 0x4B00F1: dix_main (main.c:284)
 |     by 0x42879D: main (stubmain.c:34)
 |   Block was alloc'd at
 |     at 0x48463F3: calloc (vg_replace_malloc.c:1675)
 |     by 0x5362A1: present_create_notifies (present_notify.c:81)
 |     by 0x5368E9: proc_present_pixmap_common (present_request.c:164)
 |     by 0x536A7D: proc_present_pixmap (present_request.c:189)
 |     by 0x536FA9: proc_present_dispatch (present_request.c:337)
 |     by 0x4A1E4E: Dispatch (dispatch.c:561)
 |     by 0x4B00F1: dix_main (main.c:284)
 |     by 0x42879D: main (stubmain.c:34)

To fix the issue, count and remove the actual number of notify elements
added in case of error.

CVE-2025-62229, ZDI-CAN-27238

This vulnerability was discovered by:
Jan-Niklas Sohn working with Trend Micro Zero Day Initiative

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2086>
2025-10-28 13:22:43 +01:00
Takashi Yano
3b39aebf98 Fix mach64 driver crash
Due to lack of iopl(3), mach64 driver crashes when ior(BUS_CNTL) is
called. Since BUS_CNTL is out of the range 0x0000-0x03ff, ioperm(0,
1024, 1) is not sufficient and the ior() causes access violation.
This patch reintroduce iopl(3) call in the function hwEnableIO().

Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1110521
Fixes: a0f738a673 ("Fixed ioperm calls in hwEnableIO")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2052>
2025-10-25 20:34:53 +00:00
Alan Coopersmith
ed92eae84d dix: avoid memory leak in ProcListProperties()
Reported in #1817:
xwayland-24.1.6/redhat-linux-build/../dix/property.c:584:5:
 warning[-Wanalyzer-malloc-leak]: leak of ‘pAtoms’

Can happen if, and only if, XaceHookPropertyAccess() blocks access
to all properties, so that numProps ends up zero on the second loop.

Fixes: 39f337fd4 ("dix: ProcListProperties: skip unneeded work if numProps is 0")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2078>
2025-10-17 18:04:36 +00:00