Go to file
Martin Peres 50c1671647 os: make sure the clientsWritable fd_set is initialized before use
In WaitForSomething(), the fd_set clientsWritable may be used
unitialized when the boolean AnyClientsWriteBlocked is set in the
WakeupHandler(). This leads to a crash in FlushAllOutput() after
x11proto's commit 2c94cdb453bc641246cc8b9a876da9799bee1ce7.

The problem did not manifest before because both the XFD_SIZE and the
maximum number of clients were set to 256. As the connectionTranslation
table was initalized for the 256 clients to 0, the test on the index not
being 0 was aborting before dereferencing the client #0.

As of commit 2c94cdb453bc641246cc8b9a876da9799bee1ce7 in x11proto, the
XFD_SIZE got bumped to 512. This lead the OutputPending fd_set to have
any fd above 256 to be uninitialized which in turns lead to reading an
index after the end of the ConnectionTranslation table. This index would
then be used to find the client corresponding to the fd marked as
pending writes and would also result to an out-of-bound access which
would usually be the fatal one.

Fix this by zeroing the clientsWritable fd_set at the beginning of
WaitForSomething(). In this case, the bottom part of the loop, which
would indirectly call FlushAllOutput, will not do any work but the next
call to select will result in the execution of the right codepath. This
is exactly what we want because we need to know the writable clients
before handling them. In the end, it also makes sure that the fds above
MaxClient are initialized, preventing the crash in FlushAllOutput().

Thanks to everyone involved in tracking this one down!

Reported-by: Karol Herbst <freedesktop@karolherbst.de>
Reported-by: Tobias Klausmann <tobias.klausmann@mni.thm.de>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
Tested-by: Tobias Klausmann <tobias.klausmann@mni.thm.de>
Tested-by: Martin Peres <martin.peres@linux.intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91316
Cc: Ilia Mirkin  <imirkin@alum.mit.edu>
Cc: Olivier Fourdan <ofourdan@redhat.com
Cc: Adam Jackson <ajax@redhat.com>
Cc: Alan Coopersmith <alan.coopersmith@oracle.com
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2015-10-27 16:11:32 -04:00
composite composite: Factor out backing store transition 2015-09-24 13:01:51 -04:00
config config: remove 10-evdev.conf, let the evdev driver install that file 2015-05-18 13:41:09 +10:00
damageext Replace 'pointer' type with 'void *' 2014-01-12 10:24:11 -08:00
dbe Convert top level extensions to new *allocarray functions 2015-04-21 16:57:08 -07:00
dix fonts: Continue when font calls return Suspended more than once 2015-10-19 13:41:27 -04:00
doc doc: Convert an \fP pair into appropriate tags. 2015-09-23 10:32:53 -04:00
dri3 dri3: static cleanup 2015-07-08 16:40:57 -04:00
exa build: Remove stale miext/cw include paths 2015-10-27 13:46:13 -04:00
fb Fix alphamap interactions with wfb 2015-09-29 12:21:34 -04:00
glamor glamor: Get rid of an extraneous ; at the end of a C source line 2015-09-30 10:24:33 -07:00
glx glx: Fix header length error checking in __glXDisp_RenderLarge 2015-10-19 11:51:58 -04:00
hw build: Remove stale miext/cw include paths 2015-10-27 13:46:13 -04:00
include kdrive: Delete unused TOUCHSCREEN define. 2015-10-06 10:43:05 -04:00
m4 configure.ac: remove remaining TLS references 2015-03-24 17:20:26 +00:00
man man: Fix case for MIT-unspecified. 2015-09-23 10:24:48 -04:00
mi mi: Correct a miscall of abs() to instead call fabs() 2015-10-19 11:49:52 -04:00
miext rootless: Fix bogus handling of broken root clip 2015-09-21 17:44:48 -04:00
os os: make sure the clientsWritable fd_set is initialized before use 2015-10-27 16:11:32 -04:00
present present: Fix missed notify MSC computation 2015-10-21 15:13:41 -04:00
pseudoramiX Convert top level extensions to new *allocarray functions 2015-04-21 16:57:08 -07:00
randr randr: make RROutputChanged change the main protocol screen not the gpu screen 2015-10-21 15:13:22 -04:00
record Convert top level extensions to new *allocarray functions 2015-04-21 16:57:08 -07:00
render render: Propagate allocation failure from createSourcePicture() 2015-10-06 13:18:22 -04:00
test build: Remove stale miext/cw include paths 2015-10-27 13:46:13 -04:00
Xext Xext: fix build with --disable-xace 2015-10-27 10:51:38 -04:00
xfixes xfixes: Unexport xfixes.h 2015-07-08 16:40:58 -04:00
Xi Xi: Silence some tautological warnings 2015-10-20 09:07:31 +10:00
xkb xkb: Keyboard mouse button emulation should not suppress other keyboard events 2015-09-29 12:21:34 -04:00
.dir-locals.el Add .dir-locals.el 2013-08-17 12:17:36 +02:00
.gitignore .gitignore: Add new autotools file 'test-driver' 2014-04-21 13:41:42 -07:00
autogen.sh autogen.sh: use quoted string variables 2015-03-13 12:31:21 +10:00
configure.ac xserver 1.17.99.902 (1.18 RC2) 2015-10-26 13:47:04 -04:00
COPYING modesetting: Merge modesetting's COPYING into the xserver's. 2014-09-15 12:46:02 -07:00
devbook.am doc: Create a script to filter xmlto output 2015-01-05 14:24:06 -08:00
docbook.am docbook.am: embed css styles inside the HTML HEAD element 2011-09-21 14:07:49 -07:00
fix-miregion Change region implementation names to eliminate the 'mi' prefix 2010-06-05 17:47:32 -07:00
fix-miregion-private Change region implementation names to eliminate the 'mi' prefix 2010-06-05 17:47:32 -07:00
fix-patch-whitespace Rename region macros to eliminate screen argument 2010-06-05 18:59:00 -07:00
fix-region Rename region macros to eliminate screen argument 2010-06-05 18:59:00 -07:00
Makefile.am DIST_SUBDIRS needs to include glamor, even if it isn't built 2014-02-13 15:25:56 -08:00
manpages.am Xorg: Add a suid root wrapper 2014-03-12 08:50:05 +01:00
README packaging: provide a default README file #24206 2010-01-27 14:00:17 -08:00
xorg-server.m4 macros: clarify documentation 2012-11-05 13:24:57 -06:00
xorg-server.pc.in xfree86: link modules against Xorg symbols on Cygwin 2012-04-05 21:57:07 -05:00
xserver.ent.in doc: relocate xserver.ent in the package root directory 2011-05-14 11:22:26 -07:00

					X Server

The X server accepts requests from client applications to create windows,
which are (normally rectangular) "virtual screens" that the client program
can draw into.

Windows are then composed on the actual screen by the X server
(or by a separate composite manager) as directed by the window manager,
which usually communicates with the user via graphical controls such as buttons
and draggable titlebars and borders.

For a comprehensive overview of X Server and X Window System, consult the
following article:
http://en.wikipedia.org/wiki/X_server

All questions regarding this software should be directed at the
Xorg mailing list:

        http://lists.freedesktop.org/mailman/listinfo/xorg

Please submit bug reports to the Xorg bugzilla:

        https://bugs.freedesktop.org/enter_bug.cgi?product=xorg

The master development code repository can be found at:

        git://anongit.freedesktop.org/git/xorg/xserver

        http://cgit.freedesktop.org/xorg/xserver

For patch submission instructions, see:

	http://www.x.org/wiki/Development/Documentation/SubmittingPatches

For more information on the git code manager, see:

        http://wiki.x.org/wiki/GitPage