From: Sasha Levin <levinsasha928@gmail.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] pc_init: Fail on bad kernel
Date: Wed, 14 Sep 2011 10:45:22 +0300 [thread overview]
Message-ID: <1315986322.3744.11.camel@lappy> (raw)
In-Reply-To: <1315078543-28522-1-git-send-email-levinsasha928@gmail.com>
Ping?
On Sat, 2011-09-03 at 22:35 +0300, Sasha Levin wrote:
> When providing QEMU with a bad '-kernel' parameter, such as a file which
> is not really a kernel, QEMU will attempt to allocate a huge amount of
> memory and fail either with "Failed to allocate memory: Cannot allocate
> memory" or a GLib error: "GLib-ERROR **: gmem.c:170: failed to allocate
> 18446744073709529965 bytes"
>
> This patch handles the case where the magic sig wasn't located in the
> provided kernel, and loading it as multiboot failed as well.
>
> Cc: Anthony Liguori <aliguori@us.ibm.com>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
> hw/pc.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/hw/pc.c b/hw/pc.c
> index 6b3662e..428440b 100644
> --- a/hw/pc.c
> +++ b/hw/pc.c
> @@ -691,8 +691,14 @@ static void load_linux(void *fw_cfg,
> /* This looks like a multiboot kernel. If it is, let's stop
> treating it like a Linux kernel. */
> if (load_multiboot(fw_cfg, f, kernel_filename, initrd_filename,
> - kernel_cmdline, kernel_size, header))
> + kernel_cmdline, kernel_size, header)) {
> return;
> + } else {
> + fprintf(stderr, "qemu: could not load kernel '%s': %s\n",
> + kernel_filename, strerror(errno));
> + exit(1);
> + }
> +
> protocol = 0;
> }
>
--
Sasha.
next prev parent reply other threads:[~2011-09-14 7:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-03 19:35 [Qemu-devel] [PATCH] pc_init: Fail on bad kernel Sasha Levin
2011-09-09 17:57 ` Anthony Liguori
2011-09-14 7:45 ` Sasha Levin [this message]
2011-09-14 12:54 ` Anthony Liguori
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=1315986322.3744.11.camel@lappy \
--to=levinsasha928@gmail.com \
--cc=aliguori@us.ibm.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).