All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Eduardo Habkost <ehabkost@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PULL for-2.10 09/15] oslib-posix: Print errors before aborting on qemu_alloc_stack()
Date: Thu, 31 Aug 2017 09:22:04 +0100	[thread overview]
Message-ID: <20170831082210.8362-10-stefanha@redhat.com> (raw)
In-Reply-To: <20170831082210.8362-1-stefanha@redhat.com>

From: Eduardo Habkost <ehabkost@redhat.com>

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>
---
 util/oslib-posix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index cacf0ef5e3..80086c549f 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();
     }
 
-- 
2.13.5

  parent reply	other threads:[~2017-08-31  8:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-31  8:21 [Qemu-devel] [PULL for-2.10 00/15] Block patches Stefan Hajnoczi
2017-08-31  8:21 ` [Qemu-devel] [PULL for-2.10 01/15] nvme: Fix get/set number of queues feature, again Stefan Hajnoczi
2017-08-31  8:21 ` [Qemu-devel] [PULL for-2.10 02/15] throttle: Fix wrong variable name in the header documentation Stefan Hajnoczi
2017-08-31  8:21 ` [Qemu-devel] [PULL for-2.10 03/15] throttle: Update the throttle_fix_bucket() documentation Stefan Hajnoczi
2017-08-31  8:21 ` [Qemu-devel] [PULL for-2.10 04/15] throttle: Make throttle_is_valid() a bit less verbose Stefan Hajnoczi
2017-08-31  8:22 ` [Qemu-devel] [PULL for-2.10 05/15] throttle: Remove throttle_fix_bucket() / throttle_unfix_bucket() Stefan Hajnoczi
2017-09-12 17:37   ` Peter Maydell
2017-08-31  8:22 ` [Qemu-devel] [PULL for-2.10 06/15] throttle: Make LeakyBucket.avg and LeakyBucket.max integer types Stefan Hajnoczi
2017-08-31  8:22 ` [Qemu-devel] [PULL for-2.10 07/15] throttle: Make burst_length 64bit and add range checks Stefan Hajnoczi
2017-08-31  8:22 ` [Qemu-devel] [PULL for-2.10 08/15] throttle: Test the valid range of config values Stefan Hajnoczi
2017-08-31  8:22 ` Stefan Hajnoczi [this message]
2017-08-31  8:22 ` [Qemu-devel] [PULL for-2.10 10/15] misc: Remove unused Error variables Stefan Hajnoczi
2017-08-31  8:22 ` [Qemu-devel] [PULL for-2.10 11/15] scripts: add argparse module for Python 2.6 compatibility Stefan Hajnoczi
2017-08-31  8:22 ` [Qemu-devel] [PULL for-2.10 12/15] docker.py: Python 2.6 argparse compatibility Stefan Hajnoczi
2017-08-31  8:22 ` [Qemu-devel] [PULL for-2.10 13/15] tests: migration/guestperf " Stefan Hajnoczi
2017-08-31  8:22 ` [Qemu-devel] [PULL for-2.10 14/15] qemu-doc: Add UUID support in initiator name Stefan Hajnoczi
2017-08-31  8:22 ` [Qemu-devel] [PULL for-2.10 15/15] qcow2: allocate cluster_cache/cluster_data on demand Stefan Hajnoczi
2017-08-31  8:37 ` [Qemu-devel] [PULL for-2.10 00/15] Block patches no-reply
2017-08-31 13:47 ` Eric Blake
2017-08-31 14:51 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170831082210.8362-10-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.