aboutsummaryrefslogtreecommitdiff
path: root/softmmu/cpus.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2021-12-17 14:46:10 +0100
committerMichael S. Tsirkin <mst@redhat.com>2022-01-07 19:30:13 -0500
commit29b838c05dc20fa00fc08e952f710478829aa1c7 (patch)
tree5ba93a7d8e650d49c466b55af562d6e6e23d793b /softmmu/cpus.c
parenta960d6642d39f7d255b7b2b8bda3c2ae4e4e649b (diff)
util/oslib-posix: Forward SIGBUS to MCE handler under Linux
Temporarily modifying the SIGBUS handler is really nasty, as we might be unlucky and receive an MCE SIGBUS while having our handler registered. Unfortunately, there is no way around messing with SIGBUS when MADV_POPULATE_WRITE is not applicable or not around. Let's forward SIGBUS that don't belong to us to the already registered handler and document the situation. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20211217134611.31172-8-david@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'softmmu/cpus.c')
-rw-r--r--softmmu/cpus.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
index 071085f840..23bca46b07 100644
--- a/softmmu/cpus.c
+++ b/softmmu/cpus.c
@@ -352,6 +352,10 @@ static void qemu_init_sigbus(void)
{
struct sigaction action;
+ /*
+ * ALERT: when modifying this, take care that SIGBUS forwarding in
+ * os_mem_prealloc() will continue working as expected.
+ */
memset(&action, 0, sizeof(action));
action.sa_flags = SA_SIGINFO;
action.sa_sigaction = sigbus_handler;