diff mbox series

[13/13] linux-user: Align mmap_find_vma to host page size

Message ID 20190519201953.20161-14-richard.henderson@linaro.org
State New
Headers show
Series [01/13] util/path: Do not cache all filenames at startup | expand

Commit Message

Richard Henderson May 19, 2019, 8:19 p.m. UTC
This can avoid stack allocation failures for i386 guest
on ppc64 (64k page) host.

Suggested-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/mmap.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Laurent Vivier May 22, 2019, 9:45 a.m. UTC | #1
On 19/05/2019 22:19, Richard Henderson wrote:
> This can avoid stack allocation failures for i386 guest
> on ppc64 (64k page) host.
> 
> Suggested-by: Laurent Vivier <laurent@vivier.eu>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   linux-user/mmap.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/linux-user/mmap.c b/linux-user/mmap.c
> index 10796b37ac..af41339d57 100644
> --- 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;
> 

Applied to my linux-user branch.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/linux-user/mmap.c b/linux-user/mmap.c
index 10796b37ac..af41339d57 100644
--- 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;