* [Qemu-devel] [PATCH] linux-user: fix mmap_find_vma_reserved()
@ 2018-07-11 16:33 Laurent Vivier
0 siblings, 0 replies; only message in thread
From: Laurent Vivier @ 2018-07-11 16:33 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Riku Voipio, Richard Henderson
The value given by mmap_find_vma_reserved() is used with mmap(),
so it is needed to be aligned with the host page size.
Since commit 18e80c55bb, reserved_va is only aligned to TARGET_PAGE_SIZE,
and it works well if this size is greater or equal to the host page size.
But ppc64 hosts have 64kB page size and when we start a 4kiB page size
guest (like i386), it fails when it tries to mmap the stack:
mmap stack: Invalid argument
Fixes: 18e80c55bb (linux-user: Tidy and enforce reserved_va initialization)
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
linux-user/main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/linux-user/main.c b/linux-user/main.c
index 52b5a618fe..a370b89ee6 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -689,6 +689,11 @@ int main(int argc, char **argv, char **envp)
target_environ = envlist_to_environ(envlist, NULL);
envlist_free(envlist);
+ /* reserved_va must be aligned with the host page size
+ * has it is used with mmap()
+ */
+ reserved_va &= qemu_host_page_mask;
+
/*
* Now that page sizes are configured in tcg_exec_init() we can do
* proper page alignment for guest_base.
--
2.17.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-07-11 16:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-11 16:33 [Qemu-devel] [PATCH] linux-user: fix mmap_find_vma_reserved() Laurent Vivier
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.