* [Qemu-devel] [PATCH] linux-user: Fixed brk syscall memory allocation
@ 2016-09-13 13:14 Stanislav Shmarov
2016-09-14 12:01 ` Stanislav Shmarov
0 siblings, 1 reply; 2+ messages in thread
From: Stanislav Shmarov @ 2016-09-13 13:14 UTC (permalink / raw)
To: qemu-devel; +Cc: Riku Voipio, Stanislav Shmarov
When application is trying to allocate memory through brk
QEMU is allocating host memory using mmap.
Without MAP_FIXED attribute it is possible that memory will
never be allocated in desired place, and brk syscall will
act like there is no avalible memory.
Signed-off-by: Stanislav Shmarov <snarpix@gmail.com>
---
linux-user/syscall.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index ca06943..2861db2 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1030,7 +1030,8 @@ abi_long do_brk(abi_ulong new_brk)
new_alloc_size = HOST_PAGE_ALIGN(new_brk - brk_page);
mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size,
PROT_READ|PROT_WRITE,
- MAP_ANON|MAP_PRIVATE, 0, 0));
+ MAP_ANON | MAP_PRIVATE | MAP_FIXED,
+ 0, 0));
if (mapped_addr == brk_page) {
/* Heap contents are initialized to zero, as for anonymous
--
1.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] linux-user: Fixed brk syscall memory allocation
2016-09-13 13:14 [Qemu-devel] [PATCH] linux-user: Fixed brk syscall memory allocation Stanislav Shmarov
@ 2016-09-14 12:01 ` Stanislav Shmarov
0 siblings, 0 replies; 2+ messages in thread
From: Stanislav Shmarov @ 2016-09-14 12:01 UTC (permalink / raw)
To: qemu-devel
Please ignore this patch. Issue was in another place, and proposed solution
is simply wrong.
2016-09-13 16:14 GMT+03:00 Stanislav Shmarov <snarpix@gmail.com>:
> When application is trying to allocate memory through brk
> QEMU is allocating host memory using mmap.
> Without MAP_FIXED attribute it is possible that memory will
> never be allocated in desired place, and brk syscall will
> act like there is no avalible memory.
>
> Signed-off-by: Stanislav Shmarov <snarpix@gmail.com>
> ---
> linux-user/syscall.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index ca06943..2861db2 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -1030,7 +1030,8 @@ abi_long do_brk(abi_ulong new_brk)
> new_alloc_size = HOST_PAGE_ALIGN(new_brk - brk_page);
> mapped_addr = get_errno(target_mmap(brk_page, new_alloc_size,
> PROT_READ|PROT_WRITE,
> - MAP_ANON|MAP_PRIVATE, 0, 0));
> + MAP_ANON | MAP_PRIVATE |
> MAP_FIXED,
> + 0, 0));
>
> if (mapped_addr == brk_page) {
> /* Heap contents are initialized to zero, as for anonymous
> --
> 1.9.3
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-14 12:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-13 13:14 [Qemu-devel] [PATCH] linux-user: Fixed brk syscall memory allocation Stanislav Shmarov
2016-09-14 12:01 ` Stanislav Shmarov
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.