diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2017-08-29 18:20:53 -0300 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2017-08-30 09:33:49 +0100 |
commit | e916a6e88a4ff6c39cd6f62fb162a561c6b89de8 (patch) | |
tree | 3ddd5ad2e3ddf81f538e4b30965010df868e56ba /util/oslib-posix.c | |
parent | d942feec979b1ad669ba43b8c9540a7e3cf75a3f (diff) | |
download | qemu-e916a6e88a4ff6c39cd6f62fb162a561c6b89de8.zip qemu-e916a6e88a4ff6c39cd6f62fb162a561c6b89de8.tar.gz qemu-e916a6e88a4ff6c39cd6f62fb162a561c6b89de8.tar.bz2 |
oslib-posix: Print errors before aborting on qemu_alloc_stack()
If QEMU is running on a system that's out of memory and mmap()
fails, QEMU aborts with no error message at all, making it hard
to debug the reason for the failure.
Add perror() calls that will print error information before
aborting.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20170829212053.6003-1-ehabkost@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'util/oslib-posix.c')
-rw-r--r-- | util/oslib-posix.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/util/oslib-posix.c b/util/oslib-posix.c index cacf0ef..80086c5 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -530,6 +530,7 @@ void *qemu_alloc_stack(size_t *sz) ptr = mmap(NULL, *sz, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (ptr == MAP_FAILED) { + perror("failed to allocate memory for stack"); abort(); } @@ -544,6 +545,7 @@ void *qemu_alloc_stack(size_t *sz) guardpage = ptr; #endif if (mprotect(guardpage, pagesz, PROT_NONE) != 0) { + perror("failed to set up stack guard page"); abort(); } |