Changes to XInput Proto Number of Events Cause Xlib WireToEvent Vector Mismatch

Nathan Kidd nathan-svn at spicycrypto.ca
Wed Nov 25 13:42:59 PST 2009


Hi,

In the last few years inputproto's number of events (IEVENTS) has jumped
around quite a bit between 15 and 19, which has resulted in the
following issue I've recently became aware of:

E.g.

1. xserver is built from inputproto with IEVENTS as 15 (e.g. SLES 10)
    15 is statically compiled into xserver.
2. libXi is built some time later with IEVENTS as 17 (e.g. Fedora 11)
    17 is statically compiled into libXi.
3. xclient runs on machine with new libXi
  xclient -> QueryExtension(XKEYBOARD)
  xserver <- event base 100
  xlib sets event_vec[100] to an xkeyboard WireToEvent function
  xclient -> QueryExtension(XInputExtension)
  xserver <- event base 85
  xlib sets event_vec[85 .. 85 + 17] xinput WireToEvent function, i.e.
OVERWRITES xkeyboard's WireToEvent proc because xserver only allowed for
15 events between the event bases, since that's all it knew about when
it was built.
4. the wrong WireToEvent function get's used on subsequent XKEYBOARD events

On standard x.org the results aren't actually that terrible: XKEYBOARD
and LBX have their event bases right after XInputExtension so they're
the ones that get clobbered.  Since nobody uses LBX there's no effect,
and XKEYBOARD seems to a) either not be very noticable when it fails b)
not be used so often in conjunction with XInputExtension, or c) my
googling just can't turn up any complaints.  If you juggle around the
extensions (e.g. disable in xorg.conf) you can end up clobbering more
important/sensitive extension events with far worse results (here XFIXES
was after XInputExtension, triggering a segv in most gtk2 applications).


Questions:
1. Is this a known issue?  (I notice some since-reverted work to add
version info to xGetExtensionVersionReq.)

2. Is it not fundamentally a Bad Thing to be changing this statically
compiled in number of events?

I've worked around this problem by patching old X servers to use IEVENTS
= 19 (max value ever shipped in XIproto.h). That way the xserver always
allows enough room between event bases, regardless of what type of
(currently existing) libXi-using client connects.

3. Does it not makes sense for distro maintainers to apply a similar
patch to their older X branches?

-Nathan

----
Nathan Kidd
Open Text, Connectivity Solutions Group





More information about the xorg mailing list