From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36684) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvGUF-0001KZ-4b for qemu-devel@nongnu.org; Fri, 05 Jul 2013 20:36:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UvGUC-0002rG-Cp for qemu-devel@nongnu.org; Fri, 05 Jul 2013 20:36:27 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42299 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvGUC-0002qh-7K for qemu-devel@nongnu.org; Fri, 05 Jul 2013 20:36:24 -0400 From: Alexander Graf Date: Sat, 6 Jul 2013 02:36:10 +0200 Message-Id: <1373070978-11966-2-git-send-email-agraf@suse.de> In-Reply-To: <1373070978-11966-1-git-send-email-agraf@suse.de> References: <1373070978-11966-1-git-send-email-agraf@suse.de> Subject: [Qemu-devel] [PATCH 1/9] linux-user: fix segmentation fault passing with h2g(x) != x List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Riku Voipio 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 h2g(address) makes the guest process a lot happier. This fixes java running in arm-linux-user for me. Signed-off-by: Alexander Graf --- user-exec.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/user-exec.c b/user-exec.c index 26cde7c..718c54f 100644 --- a/user-exec.c +++ b/user-exec.c @@ -94,6 +94,12 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address, return 1; } + if (GUEST_BASE) { + /* Convert forcefully to guest address space, invalid addresses + are still valid segv ones */ + address = address - GUEST_BASE; + } + env = current_cpu->env_ptr; /* see if it is an MMU fault */ ret = cpu_handle_mmu_fault(env, address, is_write, MMU_USER_IDX); -- 1.6.0.2