]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MEDIUM: threads: fix a tiny race in thread_isolate()
authorWilly Tarreau <w@1wt.eu>
Sat, 27 May 2023 11:45:01 +0000 (13:45 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 27 May 2023 11:53:46 +0000 (13:53 +0200)
commit8fc70739068f4b5ba894f3de1df37cdf051c380a
tree2300fc6efe5764e60b4cae6df3c86a45a0984e56
parentbfddb42c05ee67488b54a564ede651c378a0037f
BUG/MEDIUM: threads: fix a tiny race in thread_isolate()

AurĂ©lien found a tiny race in thread_isolate() that can allow a thread
that was running under isolation to continue running while another one
enters isolation. The reason is that the check for harmless is only
done before winning the CAS, but since the previously isolated thread
doesn't wait for !rdv_request in thread_release(), it can effectively
continue its activities while the next one believes it's isolated. A
proper solution consists in looping once again in thread_isolate() to
recheck (and wait) for all threads to be isolated once the CAS is won.

The issue was introduced in 2.7 by commit 598cf3f22 ("MAJOR: threads:
change thread_isolate to support inter-group synchronization") so the
fix needs to be backported there.
src/thread.c