[Top][All Lists]

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

[Bug gold/15070] gold crashes on ARMv5 due to unaligned memory access

From: roland at gnu dot org
Subject: [Bug gold/15070] gold crashes on ARMv5 due to unaligned memory access
Date: Wed, 30 Jan 2013 22:29:45 +0000


--- Comment #1 from Roland McGrath <roland at gnu dot org> 2013-01-30 22:29:45 
UTC ---
It looks like that fix will work fine.  But it is far from obvious that
it's what's required or if it's the ideal thing.

The comment on File_read::get_view says the flag "is true if the data must
be naturally aligned".  What the fileread.cc code actually does is ensure
that it is aligned to the word-size of the ELF file (i.e. only ever to 32
bits or to 64 bits).  What "naturally aligned" means to me is aligned to
the size of the datum in question, so in get_view it looks like it would
require it to be aligned to the SIZE parameter.  That would be
unnecessarily large alignment for ELFCLASS64 (Elf64_Ehdr is 64 bytes) and
nonsensical for ELFCLASS32 (Elf32_Ehdr is 52 bytes, not a power of two).
So I think the comment on File_read::get_view in fileread.h should be
changed to be more clear about the meaning of its ALIGNED parameter.

That aside, it's not at all clear to me across all those layers where the
alignment requirement comes from.  The elfcpp code is a bit light on
comments, but I don't see any place that it states there are alignment
requirements for the pointers that File::View::data returns.  If that is
the intent, then it should be stated clearly somewhere in the interface

I think the scenario hitting this must be looking at files in an archive.
I can't think of any other situation in which the start of the ELF header
could ever be misaligned.  This makes me wonder if every other place in
gold that's using elfcpp code with its implicit assumption of aligned
header data has correctly indicated in its View implementations that the
alignment must be ensured.

Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

reply via email to

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