mbox series

[for-8.1,v2,0/3] accel/tcg: Take mmap_lock in load_atomic*_or_exit

Message ID 20230722113507.78332-1-richard.henderson@linaro.org
Headers show
Series accel/tcg: Take mmap_lock in load_atomic*_or_exit | expand

Message

Richard Henderson July 22, 2023, 11:35 a.m. UTC
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(-)