Re: [PATCH] x86, efi: Fix unaligned access and endian issues

From: Stephen Rothwell
Date: Wed Feb 22 2012 - 17:31:49 EST


Hi Matt,

On Wed, 22 Feb 2012 14:00:08 +0000 Matt Fleming <matt@xxxxxxxxxxxxxxxxx> wrote:
>
> From: Matt Fleming <matt.fleming@xxxxxxxxx>
>
> 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 a
> segfault when cross-building an x86 kernel on risc architectures.
>
> Also, we may need to convert the endianness of the data we read
> from/write to buf, so let's add some helper functions to do that.
>
> Stephen Rothwell noticed this bug when he hit a segfault while
> cross-building an x86_64 allmodconfig kernel on PowerPC.
>
> Cc: H. Peter Anvin <hpa@xxxxxxxxx>
> Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> Signed-off-by: Matt Fleming <matt.fleming@xxxxxxxxx>

Tested-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> (cross build only)

The bzImage from a ARCH=x86_64 defconfig+CONFIG_EFI_STUB cross build is
in http://ozlabs.org/~sfr/bzImage if you want to attempt to boot it.

One little thing is that those two new functions may we warned about as
unused if CONFIG_EFI_STUB is not set (I have not done that build yet).

--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx

Attachment: pgp00000.pgp
Description: PGP signature