2012-12-05 14:18:02 +01:00
|
|
|
From d53d69e169f1b1b7b0f4dc2e62110ffe9fdde0d3 Mon Sep 17 00:00:00 2001
|
2012-08-17 18:42:52 +02:00
|
|
|
From: Alexander Graf <agraf@suse.de>
|
|
|
|
Date: Mon, 25 Jun 2012 19:02:32 +0200
|
|
|
|
Subject: [PATCH] linux-user: fix segmentation fault passing with g2h(x) != x
|
|
|
|
MIME-Version: 1.0
|
2012-12-13 11:49:19 +01:00
|
|
|
Content-Type: text/plain; charset=utf-8
|
2012-08-17 18:42:52 +02:00
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
When forwarding a segmentation fault into the guest process, we were passing
|
|
|
|
the host's address directly into the guest process's signal descriptor.
|
|
|
|
|
|
|
|
That obviously confused the guest process, since it didn't know what to make
|
|
|
|
of the (usually 32-bit truncated) address. Passing in g2h(address) makes the
|
|
|
|
guest process a lot happier.
|
|
|
|
|
|
|
|
This fixes java running in arm-linux-user for me.
|
|
|
|
|
|
|
|
Signed-off-by: Alexander Graf <agraf@suse.de>
|
|
|
|
[AF: Rebased onto AREG0 fix for v1.2, squashed fixup by agraf]
|
|
|
|
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
|
|
|
---
|
|
|
|
user-exec.c | 6 ++++++
|
2012-12-13 11:49:19 +01:00
|
|
|
1 files changed, 6 insertions(+), 0 deletions(-)
|
2012-08-17 18:42:52 +02:00
|
|
|
|
|
|
|
diff --git a/user-exec.c b/user-exec.c
|
2012-11-27 21:42:06 +01:00
|
|
|
index 1ec5d9a..71afbf1 100644
|
2012-08-17 18:42:52 +02:00
|
|
|
--- a/user-exec.c
|
|
|
|
+++ b/user-exec.c
|
2012-11-27 21:42:06 +01:00
|
|
|
@@ -98,6 +98,12 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
|
2012-08-17 18:42:52 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (RESERVED_VA) {
|
|
|
|
+ /* Convert forcefully to guest address space, invalid addresses
|
|
|
|
+ are still valid segv ones */
|
|
|
|
+ address = address - GUEST_BASE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
/* see if it is an MMU fault */
|
|
|
|
ret = cpu_handle_mmu_fault(cpu_single_env, address, is_write,
|
|
|
|
MMU_USER_IDX);
|