]> git.ipfire.org Git - thirdparty/qemu.git/commit
async: access bottom half flags with qatomic_read
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 13 Oct 2025 16:24:54 +0000 (18:24 +0200)
committerMichael Tokarev <mjt@tls.msk.ru>
Wed, 15 Oct 2025 04:35:35 +0000 (07:35 +0300)
commit4e58c5bf0cf7d0bb7bc6f7b277f490d3af9367c4
treec1de89750190e4b7a241cd9b53b6bdd47d8eb2c1
parentf316e90a827b82a33d7f125e100dd05c5a4caf96
async: access bottom half flags with qatomic_read

Running test-aio-multithread under TSAN reveals data races on bh->flags.
Because bottom halves may be scheduled or canceled asynchronously,
without taking a lock, adjust aio_compute_bh_timeout() and aio_ctx_check()
to use a relaxed read to access the flags.

Use an acquire load to ensure that anything that was written prior to
qemu_bh_schedule() is visible.

Closes: https://gitlab.com/qemu-project/qemu/-/issues/2749
Closes: https://gitlab.com/qemu-project/qemu/-/issues/851
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 5142397c79330aab9bef3230991c8ac0c251110f)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
util/async.c