From: Julien Grall <julien.grall@arm.com>
To: Dirk Behme <dirk.behme@de.bosch.com>,
xen-devel@lists.xenproject.org,
Stefano Stabellini <sstabellini@kernel.org>
Subject: Re: [PATCH] xen: arm: Update arm64 image header
Date: Tue, 21 Jun 2016 12:14:46 +0100 [thread overview]
Message-ID: <576921A6.9070600@arm.com> (raw)
In-Reply-To: <1466500108-8216-1-git-send-email-dirk.behme@de.bosch.com>
Hello Dirk,
On 21/06/16 10:08, Dirk Behme wrote:
> With the Linux kernel commits
>
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/Documentation/arm64/booting.txt?id=4370eec05a887b0cd4392cd5dc5b2713174745c0
>
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/Documentation/arm64/booting.txt?id=a2c1d73b94ed49f5fac12e95052d7b140783f800
>
> the arm64 image header changed. While the size of the header isn't changed,
> some members have changed their usage.
>
> Update Xen to this updated image header.
>
> The main changes are that the first magic is gone and that there is an
> image size, now.
Whilst the first magic is gone in the new version of the header, older
kernel will still use it. So we have to support them.
>
> In case we read a size != 0, let's use this image size, now. This does
> allow us to warn if the kernel Image is larger than the size given in
> the device tree, too.
Based on the code below, you don't warn but return an error.
>
> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
> ---
> xen/arch/arm/kernel.c | 41 ++++++++++++++++++++++++-----------------
> 1 file changed, 24 insertions(+), 17 deletions(-)
>
> diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
> index 3f6cce3..1cfaf02 100644
> --- a/xen/arch/arm/kernel.c
> +++ b/xen/arch/arm/kernel.c
[...]
> @@ -354,20 +353,28 @@ static int kernel_zimage64_probe(struct kernel_info *info,
>
> copy_from_paddr(&zimage, addr, sizeof(zimage));
>
> - if ( zimage.magic0 != ZIMAGE64_MAGIC_V0 &&
> - zimage.magic1 != ZIMAGE64_MAGIC_V1 )
> + if ( zimage.magic != ZIMAGE64_MAGIC )
> return -EINVAL;
>
> - /* Currently there is no length in the header, so just use the size */
> start = 0;
> - end = size;
>
> /*
> - * Given the above this check is a bit pointless, but leave it
> - * here in case someone adds a length field in the future.
> + * Where image_size is non-zero image_size is little-endian
> + * and must be respected.
Can you explain what "must be respected" stands for?
> */
> - if ( (end - start) > size )
> + if ( zimage.image_size )
> + end = zimage.image_size;
> + else
> + end = size;
> +
> + if ( (end - start) > size ) {
> + if ( zimage.image_size ) {
> + printk(XENLOG_ERR "Error: Kernel Image size: %lu bytes > bootmodule size: %lu bytes\n",
> + zimage.image_size, (uint64_t)size);
> + printk(XENLOG_ERR "Check the device tree configuration!\n");
This message is not really helpful when using UEFI. In this case,
multiboot is not used and the kernel image will be loaded by UEFI.
However, the size of the kernel may still mismatch the value in the
field image_size.
> + }
> return -EINVAL;
> + }
>
> info->zimage.kernel_addr = addr;
> info->zimage.len = end - start;
>
Regards,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-21 11:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-21 9:08 [PATCH] xen: arm: Update arm64 image header Dirk Behme
2016-06-21 11:14 ` Julien Grall [this message]
2016-06-21 11:40 ` Dirk Behme
2016-06-21 11:59 ` Julien Grall
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=576921A6.9070600@arm.com \
--to=julien.grall@arm.com \
--cc=dirk.behme@de.bosch.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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).