Re: [RFC][PATCH 5/6] x86, efi: Fix endian issues and unalignedaccesses

From: Stephen Rothwell
Date: Tue Feb 28 2012 - 19:13:29 EST


Hi all,

On Wed, 29 Feb 2012 10:52:10 +1100 Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
>
> On Tue, 28 Feb 2012 13:37:24 +0000 Matt Fleming <matt@xxxxxxxxxxxxxxxxx> wrote:
> >
> > From: Matt Fleming <matt.fleming@xxxxxxxxx>
> >
> > We may need to convert the endianness of the data we read from/write
> > to 'buf', so let's use {get,put}_unaligned_le32() to do that. Failure
> > to do so can result in accessing invalid memory, leading to a
> > segfault. Stephen Rothwell noticed this bug while cross-building an
> > x86_64 allmodconfig kernel on PowerPC.
> >
> > We need to read from and write to 'buf' a byte at a time otherwise
> > it's possible we'll perform an unaligned access, which can lead to bus
> > errors when cross-building an x86 kernel on risc architectures.
> >
> > Cc: H. Peter Anvin <hpa@xxxxxxxxx>
> > Cc: Nick Bowler <nbowler@xxxxxxxxxxxxxxxx>
> > Tested-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> > Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> > Signed-off-by: Matt Fleming <matt.fleming@xxxxxxxxx>
>
> Just to be absolutely clear, I have not yet tested this version of the
> patch and also this fixes a problem with cross building Linus' tree (i.e.
> this is a regression with cross building introduced in v3.3-rc1).

OK, I tried just that patch on top of Linus' tree and obviously that
didn't work :-) so I pulled the x86/build branch from the tip tree into
my tree (which contained just Linus' tree of today
(v3.3-rc5-97-g891003a)). and the build failed like this:

arch/x86/boot/tools/build.c:36:22: error: asm/boot.h: No such file or directory

The build is an ARCH=x86_64 defconfig with CONFIG_EFI_STUB=y.

--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx

Attachment: pgp00000.pgp
Description: PGP signature