]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix gdb.interrupt race
authorTom Tromey <tromey@adacore.com>
Fri, 23 Feb 2024 15:59:40 +0000 (08:59 -0700)
committerTom Tromey <tromey@adacore.com>
Wed, 28 Feb 2024 16:08:16 +0000 (09:08 -0700)
commit8bb8f8346729c35433c961f7f1ed3a801776a362
tree16018f54edb869c5d52ac3ad4486355d71758e50
parent4b72a278f46245635ca03ffc8179570c07e3531a
Fix gdb.interrupt race

gdb.interrupt was introduced to implement DAP request cancellation.
However, because it can be run from another thread, and because I
didn't look deeply enough at the implementation, it turns out to be
racy.

The fix here is to lock accesses to certain globals in extension.c.

Note that this won't work in the case where configure detects that the
C++ compiler doesn't provide thread support.  This version of the
patch disables DAP entirely in this situation.

Regression tested on x86-64 Fedora 38.  I also ran gdb.dap/pause.exp
in a thread-sanitizer build tree to make sure the reported race is
gone.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31263
gdb/extension.c
gdb/python/py-dap.c