bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56487: xgselect race condition leading to abort when USE_GTK not def


From: Tom Gillespie
Subject: bug#56487: xgselect race condition leading to abort when USE_GTK not defined
Date: Sun, 10 Jul 2022 14:05:58 -0700

There is a race condition in xgselect.c leading to an abort being
raised in glib code. I have attached a patch that fixes the issue.

It took an absurd amount of time to track this down and debug. The
patch and repro file contain more information.

This is not the easiest bug to test for because the race condition is
non-deterministic, I have attached the elisp file that I use to
explore and reproduce the issue.

Ensure that you have glib installed and that you are building --with-x
so that the code in xgselect is enabled. Run configure as ./configure
--with-x-toolkit=lucid (or anything except gtk), and then run make.

Assuming process-thread-bugs.el is in the top level of the emacs repo
define the following function

function loop-abort () { while true; do src/emacs -Q -batch -l \
./process-thread-bugs.el will abort 1 || return $?; done }

You can then run loop-abort; echo $? and when the patch is not applied
Emacs will eventually abort. You can also add a call to fputs in
thread.c at the location of the comment and you will almost
immediately see the abort behavior, even when building with gtk.

Attachment: 0001-xgselect.c-avoid-race-condition-leading-to-abort.patch
Description: Source code patch

Attachment: process-thread-bugs.el
Description: application/lisp


reply via email to

[Prev in Thread] Current Thread [Next in Thread]