xserver-multidpi/os
Aaron Plattner 4308f5d3d1 os: Don't crash in AttendClient if the client is gone
If a client is in the process of being closed down, then its client->osPrivate
pointer will be set to NULL by CloseDownConnection. This can cause a crash if
freeing the client's resources results in a call to AttendClient. For example,
if the client has a pending sync fence:

 Thread 1 "X" received signal SIGSEGV, Segmentation fault.
 AttendClient (client=0x5571c4aed9a0) at ../os/connection.c:942
 (gdb) bt
 #0  AttendClient (client=0x5571c4aed9a0) at ../os/connection.c:942
 #1  0x00005571c3dbb865 in SyncAwaitTriggerFired (pTrigger=<optimized out>) at ../Xext/sync.c:694
 #2  0x00005571c3dd5749 in miSyncDestroyFence (pFence=0x5571c5063980) at ../miext/sync/misync.c:120
 #3  0x00005571c3dbbc69 in FreeFence (obj=<optimized out>, id=<optimized out>) at ../Xext/sync.c:1909
 #4  0x00005571c3d7a01d in doFreeResource (res=0x5571c506e3d0, skip=skip@entry=0) at ../dix/resource.c:880
 #5  0x00005571c3d7b1dc in FreeClientResources (client=0x5571c4aed9a0) at ../dix/resource.c:1146
 #6  FreeClientResources (client=0x5571c4aed9a0) at ../dix/resource.c:1109
 #7  0x00005571c3d5525f in CloseDownClient (client=0x5571c4aed9a0) at ../dix/dispatch.c:3473
 #8  0x00005571c3d55eeb in Dispatch () at ../dix/dispatch.c:492
 #9  0x00005571c3d59e96 in dix_main (argc=3, argv=0x7ffe7854bc28, envp=<optimized out>) at ../dix/main.c:276
 #10 0x00007fea4837cb6b in __libc_start_main (main=0x5571c3d1d060 <main>, argc=3, argv=0x7ffe7854bc28, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe7854bc18) at ../csu/libc-start.c:308
 #11 0x00005571c3d1d09a in _start () at ../Xext/sync.c:2378
 (gdb) print client->osPrivate
 $1 = (void *) 0x0

Since the client is about to be freed, its ignore count doesn't matter and
AttendClient can simply be a no-op. Check for client->clientGone in AttendClient
and remove similar checks from two callers that had them.

Signed-off-by: Aaron Plattner <aplattner@nvidia.com>
2019-11-19 10:15:05 -08:00
..
.gitignore dix and os: gitignore dix.O and os.O 2011-09-23 17:14:47 -07:00
access.c include: Remove now-empty site.h 2019-10-30 16:17:04 +00:00
auth.c Clarify authorization failure reason strings sent back to the client 2019-07-23 19:50:25 +00:00
backtrace.c os: avoid uninitialized offsets in backtrace 2018-02-19 13:12:18 -05:00
busfault.c os: Fix iteration over busfaults 2017-02-23 09:20:48 +10:00
client.c DetermineClientCmd: try using /proc/pid/cmdline on Solaris too 2017-02-14 11:33:47 -05:00
connection.c os: Don't crash in AttendClient if the client is gone 2019-11-19 10:15:05 -08:00
inputthread.c configure: Check for sigprocmask 2019-05-18 14:59:38 +00:00
io.c os: Define {ReadFdFrom,WriteFdTo}Client unconditionally 2018-03-08 14:12:36 -05:00
log.c include: Remove now-empty site.h 2019-10-30 16:17:04 +00:00
Makefile.am dtrace: Move Xserver.d from dix/ to include/ 2019-08-27 17:38:54 -04:00
meson.build meson: Add dtrace support 2019-08-27 17:38:59 -04:00
mitauth.c os: make MitGenerateCookie() independent of XCSECURITY 2017-08-22 10:59:40 -04:00
oscolor.c Use ARRAY_SIZE all over the tree 2017-10-30 13:45:20 -04:00
osdep.h os: Remove mffs() 2017-11-06 17:22:46 -05:00
osinit.c os: Make OsSignalHandler ask for core dumps for signo != SIGQUIT 2017-12-13 11:11:42 -05:00
ospoll.c ospoll: Fix Solaris ports implementation to build on Solaris 11.4 2019-09-23 15:12:01 -07:00
ospoll.h os: Add ospoll interface [v2] 2016-07-21 15:04:47 -04:00
reallocarray.c Import reallocarray() from OpenBSD 2015-04-21 16:57:08 -07:00
rpcauth.c auth: remove AuthToIDFunc and associated functions. Not used anymore. 2017-02-28 14:15:19 -05:00
strcasecmp.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
strcasestr.c Remove unneeded include of dix.h from strcasestr.c 2019-04-30 20:07:51 +00:00
strlcat.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
strlcpy.c Introduce a consistent coding style 2012-03-21 13:54:42 -07:00
strndup.c os: Ensure <dix-config.h> is included in strndup.c 2013-02-14 09:20:46 -08:00
timingsafe_memcmp.c timingsafe_memcmp: Fix meson build 2017-05-10 10:56:16 -04:00
utils.c dix: Remove -to option to set the default connection timeout 2019-10-30 16:17:04 +00:00
WaitFor.c os: Recompute whether any clients are ready after check_timers() 2018-06-26 17:03:32 -07:00
xdmauth.c auth: remove AuthToIDFunc and associated functions. Not used anymore. 2017-02-28 14:15:19 -05:00
xdmcp.c include: Remove now-empty site.h 2019-10-30 16:17:04 +00:00
xprintf.c os/xprintf: add Xvscnprintf and Xscnprintf 2012-05-03 14:59:23 +10:00
xserver_poll.c os: Fix build of xserver_poll.c on MinGW 2019-05-18 14:59:38 +00:00
xsha1.c os/xsha1.c: Add license and copyright attribution. 2015-01-02 13:39:52 -08:00
xstrans.c Clean up a couple of warnings in os/ 2013-10-31 16:58:12 -07:00