For user-only, the probe for page writability may race with another thread's mprotect. Take the mmap_lock around the operation. This is still faster than the start/end_exclusive fallback.
Changes for v2: * Introduce WITH_MMAP_LOCK_GUARD, to simplify the changes. * Fix the probes for not-writable. * Handle load_atomic8_or_exit and load_atomic16_or_exit similarly. r~ Richard Henderson (3): include/exec: Add WITH_MMAP_LOCK_GUARD accel/tcg: Fix sense of read-only probes in ldst_atomicity accel/tcg: Take mmap_lock in load_atomic*_or_exit include/exec/exec-all.h | 10 ++++++++++ bsd-user/mmap.c | 1 + linux-user/mmap.c | 1 + accel/tcg/ldst_atomicity.c.inc | 32 ++++++++++++++++++-------------- 4 files changed, 30 insertions(+), 14 deletions(-) -- 2.34.1