[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] linux-user: fix mmap_find_vma_reserved()
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] [PATCH v2] linux-user: fix mmap_find_vma_reserved() |
Date: |
Wed, 11 Jul 2018 20:27:30 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
Le 11/07/2018 à 18:40, Laurent Vivier a écrit :
> 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 <address@hidden>
Richard,
I think this fix could be merged into your "linux-user: Fix shmat
emulation by honoring host SHMLBA" patch, by adding something like this
instead:
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -262,6 +262,8 @@ abi_ulong mmap_find_vma(abi_ulong start, abi_ulong
size, abi_ulong align)
abi_ulong addr;
int wrapped, repeat;
+ align = MAX(align, qemu_host_page_size);
+
/* If 'start' == 0, then a default start address is used. */
if (start == 0) {
start = mmap_next_start;
Thanks,
Laurent