]> Git Repo - qemu.git/commitdiff
include/qemu/atomic.h: Add signal_barrier
authorRichard Henderson <[email protected]>
Tue, 9 Jul 2019 08:40:00 +0000 (10:40 +0200)
committerRichard Henderson <[email protected]>
Sun, 14 Jul 2019 10:19:00 +0000 (12:19 +0200)
We have some potential race conditions vs our user-exec signal
handler that will be solved with this barrier.

Reviewed-by: Alex BennĂ©e <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
include/qemu/atomic.h

index a6ac188188d8377d26b92206637a4966fda422a5..f9cd24c8994b92a0f249f65dcb2c7b356b401c6e 100644 (file)
 #define smp_read_barrier_depends()   barrier()
 #endif
 
+/*
+ * A signal barrier forces all pending local memory ops to be observed before
+ * a SIGSEGV is delivered to the *same* thread.  In practice this is exactly
+ * the same as barrier(), but since we have the correct builtin, use it.
+ */
+#define signal_barrier()    __atomic_signal_fence(__ATOMIC_SEQ_CST)
+
 /* Sanity check that the size of an atomic operation isn't "overly large".
  * Despite the fact that e.g. i686 has 64-bit atomic operations, we do not
  * want to use them because we ought not need them, and this lets us do a
 #define smp_read_barrier_depends()   barrier()
 #endif
 
+#ifndef signal_barrier
+#define signal_barrier()    barrier()
+#endif
+
 /* These will only be atomic if the processor does the fetch or store
  * in a single issue memory operation
  */
This page took 0.027328 seconds and 4 git commands to generate.