All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Thomas Huth <thuth@redhat.com>, qemu-s390x@nongnu.org
Cc: Cornelia Huck <cohuck@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] hw/s390x/ipl: Fix crash that occurs when -kernel is used with small images
Date: Mon, 11 Jun 2018 09:49:39 +0200	[thread overview]
Message-ID: <3a7d6318-c827-3aa3-2799-7e383132beb3@de.ibm.com> (raw)
In-Reply-To: <1528636325-4237-1-git-send-email-thuth@redhat.com>



On 06/10/2018 03:12 PM, Thomas Huth wrote:
> Add a sanity check to fix the following crash:
> 
> $ echo "Insane in the mainframe" > /tmp/test.txt
> $ s390x-softmmu/qemu-system-s390x -nographic -kernel /tmp/test.txt
> Segmentation fault (core dumped)
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>

Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>

I think a similar problem exists for INITRD_PARM_START and INITRD_PARM_SIZE. No?


> ---
>  hw/s390x/ipl.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/s390x/ipl.c b/hw/s390x/ipl.c
> index 04245b5..9bb9b50 100644
> --- a/hw/s390x/ipl.c
> +++ b/hw/s390x/ipl.c
> @@ -168,7 +168,8 @@ static void s390_ipl_realize(DeviceState *dev, Error **errp)
>           * we can not rely on the ELF entry point - it was 0x800 (the SALIPL
>           * loader) and it won't work. For this case we force it to 0x10000, too.
>           */
> -        if (pentry == KERN_IMAGE_START || pentry == 0x800) {
> +        if ((pentry == KERN_IMAGE_START || pentry == 0x800) &&
> +            kernel_size > KERN_PARM_AREA + strlen(ipl->cmdline)) {
>              ipl->start_addr = KERN_IMAGE_START;
>              /* Overwrite parameters in the kernel image, which are "rom" */
>              strcpy(rom_ptr(KERN_PARM_AREA), ipl->cmdline);
> 

  reply	other threads:[~2018-06-11  7:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-10 13:12 [Qemu-devel] [PATCH] hw/s390x/ipl: Fix crash that occurs when -kernel is used with small images Thomas Huth
2018-06-11  7:49 ` Christian Borntraeger [this message]
2018-06-11  9:24   ` Cornelia Huck
2018-06-11 10:08     ` Thomas Huth
2018-06-11 10:53       ` Christian Borntraeger

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=3a7d6318-c827-3aa3-2799-7e383132beb3@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=thuth@redhat.com \
    /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.