Navigation Menu

Skip to content

Commit

Permalink
XQuartz: Don't respond to SIGALRM on the AppKit thread
Browse files Browse the repository at this point in the history
==================
WARNING: ThreadSanitizer: data race (pid=69627)
  Write of size 8 at 0x00010dae73f8 by main thread (mutexes: write M262):
    #0 SmartScheduleTimer utils.c:1245 (X11.bin+0x0001004b21f9)
    #1 __tsan::CallUserSignalHandler(__tsan::ThreadState*, bool, bool, bool, int, my_siginfo_t*, void*) <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x0000000279f6)
    #2 __CFRunLoopRun <null>:77 (CoreFoundation+0x000000087e17)
    #3 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a062)
    #4 server_main quartzStartup.c:127 (X11.bin+0x000100039b6b)
    #5 do_start_x11_server bundle-main.c:436 (X11.bin+0x0001000022c5)
    #6 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x0001000042a9)
    #7 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000100004b44)
    #8 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #9 start <null>:29 (libdyld.dylib+0x000000005254)

  Previous read of size 8 at 0x00010dae73f8 by thread T7:
    [failed to restore the stack]

  Location is global 'SmartScheduleTime' at 0x00010dae73f8 (X11.bin+0x0001005b03f8)

  Mutex M262 (0x7d300000bd10) created at:
    #0 pthread_mutex_init <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x0000000253c3)
    #1 __CFRunLoopCreate <null>:77 (CoreFoundation+0x000000054e63)
    #2 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a062)
    #3 server_main quartzStartup.c:127 (X11.bin+0x000100039b6b)
    #4 do_start_x11_server bundle-main.c:436 (X11.bin+0x0001000022c5)
    #5 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x0001000042a9)
    #6 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000100004b44)
    #7 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #8 start <null>:29 (libdyld.dylib+0x000000005254)

  Thread T7 (tid=4051693, running) created by main thread at:
    #0 pthread_create <null>:144 (libclang_rt.tsan_osx_dynamic.dylib+0x000000024490)
    #1 create_thread quartzStartup.c:78 (X11.bin+0x0001000398dd)
    #2 QuartzInitServer quartzStartup.c:95 (X11.bin+0x000100039813)
    #3 X11ApplicationMain X11Application.m:1286 (X11.bin+0x00010001c804)
    #4 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a062)
    #5 server_main quartzStartup.c:127 (X11.bin+0x000100039b6b)
    #6 do_start_x11_server bundle-main.c:436 (X11.bin+0x0001000022c5)
    #7 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x0001000042a9)
    #8 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000100004b44)
    #9 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #10 start <null>:29 (libdyld.dylib+0x000000005254)

SUMMARY: ThreadSanitizer: data race utils.c:1245 in SmartScheduleTimer
==================
==================
WARNING: ThreadSanitizer: signal handler spoils errno (pid=69627)
    #0 SmartScheduleTimer utils.c:1244 (X11.bin+0x0001004b21a0)
    #1 __CFRunLoopRun <null>:77 (CoreFoundation+0x000000087e17)
    #2 X11ControllerMain X11Controller.m:984 (X11.bin+0x00010002a062)
    #3 server_main quartzStartup.c:127 (X11.bin+0x000100039b6b)
    #4 do_start_x11_server bundle-main.c:436 (X11.bin+0x0001000022c5)
    #5 _Xstart_x11_server mach_startupServer.c:189 (X11.bin+0x0001000042a9)
    #6 mach_startup_server mach_startupServer.c:399 (X11.bin+0x000100004b44)
    #7 mach_msg_server mach_msg.c:563 (libsystem_kernel.dylib+0x000000012186)
    #8 start <null>:29 (libdyld.dylib+0x000000005254)

SUMMARY: ThreadSanitizer: signal handler spoils errno utils.c:1244 in SmartScheduleTimer
==================

Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
  • Loading branch information
jeremyhu committed Sep 22, 2016
1 parent 2740dc1 commit 9153ec8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions hw/xquartz/quartzStartup.c
Expand Up @@ -95,6 +95,15 @@ QuartzInitServer(int argc, char **argv, char **envp)
if (!create_thread(server_thread, args)) {
FatalError("can't create secondary thread\n");
}

/* Block signals on the AppKit thread that the X11 expects to handle on its thread */
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGALRM);
#ifdef BUSFAULT
sigaddset(&set, SIGBUS);
#endif
pthread_sigmask(SIG_BLOCK, &set, NULL);
}

int
Expand Down

0 comments on commit 9153ec8

Please sign in to comment.