From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC][PATCH] Generate CRC of structure of Global Data for standalone apps
Date: Sat, 03 Sep 2011 14:13:19 +0200 [thread overview]
Message-ID: <20110903121320.3CC82140ABD4@gemini.denx.de> (raw)
In-Reply-To: <1315048903-23217-1-git-send-email-graeme.russ@gmail.com>
Dear Graeme Russ,
In message <1315048903-23217-1-git-send-email-graeme.russ@gmail.com> you wrote:
> There has been some discussion of late on the mailing list as to whether
> or not a change to the Global Data structure should trigger an increment
> to XF_VERSION. The issue is complicated by the fact that some arches have
> #ifdef's in the definition of the structure.
>
> This patch auto-generates a CRC32 checksum of the structure (as opposed to
> the contents) of the Global Data structure. Standalone applications can
> read U-Boot's CRC via the new exported get_gd_crc(). If the CRCs do not
> match, using Global Data in the standalone application would be very
> unwise.
>
> This method allows the global data structure to be modified without having
> to worry about whether existing standalone applications will suddenly fail
> with unexpected results when accessing global data - Of course, this will
> only work for standalone applications which actually use get_gd_crc() - By
> incrementing XF_VERSION, all existing standalone application (should) fail
> gracefully on a version mismatch anyway
>
> The CRC is generated by:
> - Pre-processing common.h (which includes global_data.h after all the
> board, arch and SoC defines are set)
> - Searches for a chunk of text delimited by 'typedef struct global_data {'
> and '} gd_t;'
> - Strips all blank lines and whitespaces (pre-processor already took care
> of comments)
> - Pipes the result through 'tools/gencrc32header/gencrc32header'
Sorry, but I don't consider this an even halfway robust or reliable
method. Minor changes to the text formatting, changes to remove for
example the typedef, renames of fields or appending additional fields
will all break this, while tere will actually be no problems with the
code.
THis is a level of make-believe security that is fragile, and I doubt
if it's really useful, or needed.
It's a nice idea, but the problem it addresses is mostly a theoretical
one - has anybody seen any actual bug reports that this has ever been
a real problem?
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
... The prejudices people feel about each other disappear when then
get to know each other.
-- Kirk, "Elaan of Troyius", stardate 4372.5
next prev parent reply other threads:[~2011-09-03 12:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-03 11:21 [U-Boot] [RFC][PATCH] Generate CRC of structure of Global Data for standalone apps Graeme Russ
2011-09-03 12:13 ` Wolfgang Denk [this message]
2011-09-03 12:32 ` Graeme Russ
2011-09-03 19:44 ` Wolfgang Denk
2011-09-03 23:50 ` Graeme Russ
2011-09-04 6:30 ` Albert ARIBAUD
2011-09-04 5:56 ` Graeme Russ
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=20110903121320.3CC82140ABD4@gemini.denx.de \
--to=wd@denx.de \
--cc=u-boot@lists.denx.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