From: "H. Peter Anvin" <hpa@zytor.com>
To: Ian Campbell <ijc@hellion.org.uk>
Cc: linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>
Subject: Re: [PATCH] x86: add a crc32 checksum to the kernel image.
Date: Thu, 31 Jan 2008 14:10:45 -0800 [thread overview]
Message-ID: <47A24765.3070300@zytor.com> (raw)
In-Reply-To: <1201815920-24669-3-git-send-email-ijc@hellion.org.uk>
Ian Campbell wrote:
> Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: H. Peter Anvin <hpa@zytor.com>
> ---
> Documentation/i386/boot.txt | 5 +++
> arch/x86/boot/tools/build.c | 78 +++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 83 insertions(+), 0 deletions(-)
>
> diff --git a/Documentation/i386/boot.txt b/Documentation/i386/boot.txt
> index b5f5ba1..ad201f0 100644
> --- a/Documentation/i386/boot.txt
> +++ b/Documentation/i386/boot.txt
> @@ -531,6 +531,11 @@ Protocol: 2.08+
>
> The length of the compressed payload.
>
> +**** THE IMAGE CHECKSUM
> +
> +The CRC-32 checksum of the entire file is appended to the end of the
> +file. The CRC of the file including these trailing bytes is therefore 0.
> +
Hm. I have some minor concerns about this:
* The classical length field is only available in multiples of 16 (I
realize your patches change that to some degree, but I'd hate to make
the guarantee that the image payload is the last thing in the image --
it loses flexibility for the future.) The end of the image isn't
available in all cases, so this would require padding it out to a
16-byte boundary before appending the CRC32. An mmap is guaranteed to
be zero-padded out to the next page boundary, so explicitly rounding sz
up (instead of when calculating sys_size) should do the job.
* I believe it is recommended to store the inverse of the crc32, not the
crc32 itself - it catches more errors. This is also the reason to start
out with ~0 rather than 0.
* Please don't use "unsigned long" to represent a 32-bit number.
-hpa
next prev parent reply other threads:[~2008-01-31 22:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-31 21:45 [PATCH] x86: define OBJCOPYFLAGS explicitly for each target Ian Campbell
2008-01-31 21:45 ` [PATCH] x86: use ELF format in compressed images Ian Campbell
2008-01-31 21:45 ` [PATCH] x86: add a crc32 checksum to the kernel image Ian Campbell
2008-01-31 21:45 ` [PATCH] x86: bump image header to version 2.08 Ian Campbell
2008-01-31 22:10 ` H. Peter Anvin [this message]
2008-02-01 0:23 ` [PATCH] x86: add a crc32 checksum to the kernel image H. Peter Anvin
2008-02-01 9:02 ` Ian Campbell
2008-02-01 13:07 ` Ingo Molnar
2008-02-06 1:09 ` Randy Dunlap
2008-02-06 20:58 ` Ian Campbell
2008-02-06 21:01 ` Randy Dunlap
2008-02-01 0:43 ` David Newall
2008-02-01 1:16 ` H. Peter Anvin
2008-02-01 5:46 ` David Newall
2008-02-01 10:58 ` Ian Campbell
2008-01-31 22:45 ` [PATCH] x86: define OBJCOPYFLAGS explicitly for each target Ingo Molnar
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=47A24765.3070300@zytor.com \
--to=hpa@zytor.com \
--cc=ijc@hellion.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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