bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parted fat bug on ARM platform


From: Lennert Buytenhek
Subject: Re: parted fat bug on ARM platform
Date: Mon, 7 Mar 2005 23:04:09 +0100
User-agent: Mutt/1.4.1i

On Tue, Mar 08, 2005 at 01:11:10AM +1100, Andrew Clausen wrote:

> Hi Lennert,

Hello,


> > Compiling parted 1.6.15 for ARM (armv4b) seems to work, but on
> > startup it says:
> > 
> >     A bug has been detected in GNU parted.  Please email a bug
> >     report to address@hidden containing the version (1.6.15)
> >     and the following message:GNU parted was miscompiled: the FAT
> >     boot sector should be 512 bytes.  FAT support will be disabled.
> > 
> > This patch fixes that.  Note that even with this patch, unaligned
> > accesses are not guaranteed to work on the ARM ("anything can happen",
> > an unaligned read can return any value including garbage), so you
> > can still trash your file systems if you're not careful.
> 
> Does gcc work around the problem?  (i.e. does it do the necessary
> bit-bashing based on aligned reads only?)

No.  gcc doesn't know in advance that a pointer will be unaligned,
so it will just emit a regular load/store in any case.

Most ARMs out there can trap unaligned accesses, and the kernel will
then fix up the access so that it's done only with aligned loads and
stores.  However, this must be enabled by hand by writing the correct
value into /proc/cpu/alignment (under linux.)  And at least until
2.6.11 or so, the ARM alignment trap handler blindly assumed little
endian byte ordering, so doing an unaligned load on a big endian ARM
(most ARMs can run in either big endian or little endian mode) with
alignment fixups enabled would give you a byteswapped value.

Whenever the linux kernel does a load that it suspects might be not
properly aligned, it uses a function called get_unaligned(), which
then uses aligned accesses, instead of dereferencing the pointer
directly.  There is no such function for stores, though.

There's also a kernel option to have unaligned userspace accesses
send a fatal signal to the offending process, so it would be easy
for me to test patches.  (Just shout if you need (temporary) shell
access to an ARM box.)


cheers,
Lennert




reply via email to

[Prev in Thread] Current Thread [Next in Thread]