xserver/xkb
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Olivier Fourdan 407a7aa831 xkb: Fix bounds check in _CheckSetGeom()
As reported by valgrind:

  == Conditional jump or move depends on uninitialised value(s)
  ==    at 0x5CBE66: SrvXkbAddGeomKeyAlias (XKBGAlloc.c:585)
  ==    by 0x5AC7D5: _CheckSetGeom (xkb.c:5607)
  ==    by 0x5AC952: _XkbSetGeometry (xkb.c:5643)
  ==    by 0x5ACB58: ProcXkbSetGeometry (xkb.c:5684)
  ==    by 0x5B0DAC: ProcXkbDispatch (xkb.c:7070)
  ==    by 0x4A28C5: Dispatch (dispatch.c:553)
  ==    by 0x4B0B24: dix_main (main.c:274)
  ==    by 0x42915E: main (stubmain.c:34)
  ==  Uninitialised value was created by a heap allocation
  ==    at 0x4840B26: malloc (vg_replace_malloc.c:447)
  ==    by 0x5E13B0: AllocateInputBuffer (io.c:981)
  ==    by 0x5E05CD: InsertFakeRequest (io.c:516)
  ==    by 0x4AA860: NextAvailableClient (dispatch.c:3629)
  ==    by 0x5DE0D7: AllocNewConnection (connection.c:628)
  ==    by 0x5DE2C6: EstablishNewConnections (connection.c:692)
  ==    by 0x5DE600: HandleNotifyFd (connection.c:809)
  ==    by 0x5E2598: ospoll_wait (ospoll.c:660)
  ==    by 0x5DA00C: WaitForSomething (WaitFor.c:208)
  ==    by 0x4A26E5: Dispatch (dispatch.c:493)
  ==    by 0x4B0B24: dix_main (main.c:274)
  ==    by 0x42915E: main (stubmain.c:34)

Each key alias entry contains two key names (the alias and the real key
name), each of size XkbKeyNameLength.

The current bounds check only validates the first name, allowing
XkbAddGeomKeyAlias to potentially read uninitialized memory when
accessing the second name at &wire[XkbKeyNameLength].

To fix this, change the value to check to use 2 * XkbKeyNameLength to
validate the bounds.

CVE-2026-34000, ZDI-CAN-28679

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

Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/2176>
2026-04-21 10:41:26 +02:00
..
ddxBeep.c xkb: drop special generation magic on atom initialization 2025-11-20 16:36:29 +01:00
ddxCtrls.c xkb: unexport XkbDDX*() functions 2025-06-12 17:21:45 +02:00
ddxKillSrv.c xkb: unexport DDX entry points 2025-06-12 17:21:45 +02:00
ddxLEDs.c xkb: unexport XkbDDX*() functions 2025-06-12 17:21:45 +02:00
ddxLoad.c os: unexport internal logging functions 2025-06-12 17:21:46 +02:00
ddxPrivate.c xkb: unexport DDX entry points 2025-06-12 17:21:45 +02:00
ddxVT.c xkb: unexport DDX entry points 2025-06-12 17:21:45 +02:00
maprules.c xkb: variable cleanup in SetUpRemap() 2025-10-21 14:27:33 +02:00
meson.build xkb: inline remaining byte-swapping 2025-10-29 10:58:37 +01:00
README.compiled
xkb-procs.h xkb: inline remaining byte-swapping 2025-10-29 10:58:37 +01:00
xkb.c xkb: Fix bounds check in _CheckSetGeom() 2026-04-21 10:41:26 +02:00
xkbAccessX.c treewide: drop unnecessary includes of Xi/eglobals.h 2025-09-09 14:41:10 +02:00
xkbActions.c dix: unexport PrintPassiveGrabs() and PrintWindowTree() 2025-11-20 19:22:18 +01:00
XKBAlloc.c xkb: unexport XkbAllocControls() 2025-06-12 17:21:45 +02:00
xkbDflts.h xkb: move include guards up to wrap the whole file 2025-11-21 15:20:11 +01:00
xkbEvents.c xkb: Free the XKB resource when freeing XkbInterest 2025-10-28 19:36:27 +01:00
xkbfile_priv.h
xkbfmisc.c
xkbfmisc_priv.h
XKBGAlloc.c xkb: fix incorrect size check when growing doodads in a section 2026-04-21 10:18:42 +02:00
xkbgeom.h xkb: xkbgeom.h: drop stale forward declarations 2025-06-12 17:21:44 +02:00
xkbInit.c xkb: plug memory leaks in InitKeyboardDeviceStructInternal() error paths 2026-04-21 10:15:31 +02:00
xkbLEDs.c xres/xkb/xvmc/modesetting: Fix incorrect pointer data size usage 2025-06-13 13:01:24 +02:00
XKBMAlloc.c XKBMAlloc: Solve CodeQL Alert Potential use after double free 2025-07-23 14:40:42 +02:00
XKBMisc.c xkb: XKBMisc: use C99 declarations in XkbApplyCompatMapToKey 2025-09-15 10:47:40 +02:00
xkbout.c xkb: move _XkbLibError macro into private header 2025-06-12 17:21:44 +02:00
xkbout_priv.h
xkbPrKeyEv.c os: unexport internal logging functions 2025-06-12 17:21:46 +02:00
xkbrules_priv.h xkb: unexport XkbRF_VarDefsRec struct 2025-06-12 17:21:47 +02:00
xkbsrv_priv.h xkb: unexport XkbGetCoreMap() and XkbSetRepeatKeys() 2025-11-19 13:32:12 +01:00
xkbtext.c xkb: fix potential buff overflow in XkbVModIndexText for XkbCFile format 2026-04-21 10:19:13 +02:00
xkbtext_priv.h
xkbUtils.c xkb: Fix key type without level names in XkbCopyKeymap 2026-04-21 10:35:15 +02:00
XKM_file_format.txt
xkmread.c dix: fix int mismatches related to MakeAtom() 2025-08-11 20:05:57 +02:00

The X server uses this directory to store the compiled version of the
current keymap and/or any scratch keymaps used by clients.  The X server
or some other tool might destroy or replace the files in this directory,
so it is not a safe place to store compiled keymaps for long periods of
time.  The default keymap for any server is usually stored in:
     X<num>-default.xkm
where <num> is the display number of the server in question, which makes
it possible for several servers *on the same host* to share the same 
directory.

Unless the X server is modified, sharing this directory between servers on
different hosts could cause problems.