All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: grub-devel@gnu.org
Subject: Re: [PATCH] fix attempt to seek outside of the file error when parsing xen ELF notes
Date: Thu, 3 Mar 2016 21:17:27 +0300	[thread overview]
Message-ID: <56D87FB7.8070108@gmail.com> (raw)
In-Reply-To: <20160303073328.GA32595@leap-t5810.suse>

03.03.2016 10:33, Michael Chang пишет:
> The kernel bzImage payload length appears to be incorrectly minus by 4 when
> trying to grub_file_offset_open for the uncompressed vmlinux image. If gzip
> used as compressor it will lead to the file->size read from offset of crc32
> instead of the uncompressed image size.
> 
> [1]
> http://www.onicos.com/staff/iz/formats/gzip.html
> ---
>  grub-core/loader/i386/xen_file.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/grub-core/loader/i386/xen_file.c b/grub-core/loader/i386/xen_file.c
> index 5836218..37f9ad8 100644
> --- a/grub-core/loader/i386/xen_file.c
> +++ b/grub-core/loader/i386/xen_file.c
> @@ -55,11 +55,11 @@ grub_xen_file (grub_file_t file)
>    grub_dprintf ("xen", "found bzimage payload 0x%llx-0x%llx\n",
>  		(unsigned long long) (lh.setup_sects + 1) * 512
>  		+ lh.payload_offset,
> -		(unsigned long long) lh.payload_length - 4);
> +		(unsigned long long) lh.payload_length);
>  
>    off_file = grub_file_offset_open (file, (lh.setup_sects + 1) * 512
>  				    + lh.payload_offset,
> -				    lh.payload_length - 4);
> +				    lh.payload_length);
>    if (!off_file)
>      goto fail;
>  
> 
Looks strange indeed. I wonder what was original intention, code looked
this way from the very beginning. May be it is required with some other
format?


  reply	other threads:[~2016-03-03 18:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03  7:33 [PATCH] fix attempt to seek outside of the file error when parsing xen ELF notes Michael Chang
2016-03-03 18:17 ` Andrei Borzenkov [this message]
2016-03-04  6:50   ` Michael Chang
2016-03-11  7:13   ` Vladimir 'phcoder' Serbinenko

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=56D87FB7.8070108@gmail.com \
    --to=arvidjaar@gmail.com \
    --cc=grub-devel@gnu.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.