aboutsummaryrefslogtreecommitdiff
path: root/include/exec/cpu_ldst.h
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-06-13 15:54:22 -0700
committerRichard Henderson <richard.henderson@linaro.org>2019-07-14 12:19:00 +0200
commit08b97f7ff299df35c61bc74b8e53dbe23d59470b (patch)
treeb18acf673a37288f99acc2c2546c42908dc20673 /include/exec/cpu_ldst.h
parent359896dfa4e9707e1acea99129d324250fccab04 (diff)
downloadqemu-08b97f7ff299df35c61bc74b8e53dbe23d59470b.zip
qemu-08b97f7ff299df35c61bc74b8e53dbe23d59470b.tar.gz
qemu-08b97f7ff299df35c61bc74b8e53dbe23d59470b.tar.bz2
tcg: Introduce set/clear_helper_retaddr
At present we have a potential error in that helper_retaddr contains data for handle_cpu_signal, but we have not ensured that those stores will be scheduled properly before the operation that may fault. It might be that these races are not in practice observable, due to our use of -fno-strict-aliasing, but better safe than sorry. Adjust all of the setters of helper_retaddr. Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/exec/cpu_ldst.h')
-rw-r--r--include/exec/cpu_ldst.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/exec/cpu_ldst.h b/include/exec/cpu_ldst.h
index a08b11b..9de8c93 100644
--- a/include/exec/cpu_ldst.h
+++ b/include/exec/cpu_ldst.h
@@ -89,6 +89,26 @@ typedef target_ulong abi_ptr;
extern __thread uintptr_t helper_retaddr;
+static inline void set_helper_retaddr(uintptr_t ra)
+{
+ helper_retaddr = ra;
+ /*
+ * Ensure that this write is visible to the SIGSEGV handler that
+ * may be invoked due to a subsequent invalid memory operation.
+ */
+ signal_barrier();
+}
+
+static inline void clear_helper_retaddr(void)
+{
+ /*
+ * Ensure that previous memory operations have succeeded before
+ * removing the data visible to the signal handler.
+ */
+ signal_barrier();
+ helper_retaddr = 0;
+}
+
/* In user-only mode we provide only the _code and _data accessors. */
#define MEMSUFFIX _data