From: ebiederm@xmission.com (Eric W. Biederman)
To: "Magnus Damm" <magnus.damm@gmail.com>
Cc: "Jeremy Fitzhardinge" <jeremy@goop.org>,
"David Miller" <davem@davemloft.net>,
horms@verge.net.au, magnus@valinux.co.jp,
linux-kernel@vger.kernel.org, vgoyal@in.ibm.com, ak@muc.de,
fastboot@lists.osdl.org, anderson@redhat.com
Subject: Re: [PATCH 02/02] Elf: Align elf notes properly
Date: Sun, 12 Nov 2006 20:03:30 -0700 [thread overview]
Message-ID: <m1irhkt5dp.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <aec7e5c30611121816s2087c455o6dea419d13de5615@mail.gmail.com> (Magnus Damm's message of "Mon, 13 Nov 2006 11:16:19 +0900")
"Magnus Damm" <magnus.damm@gmail.com> writes:
> On 11/11/06, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
>> David Miller wrote:
>> > We should be OK with the elf note header since n_namesz, n_descsz, and
>> > n_type are 32-bit types even on Elf64. But for the contents embedded
>> > in the note, I am not convinced that there are no potential issues
>>
>> PT_NOTE segments are not generally mmaped directly, nor are they
>> generally very large. There should be no problem for a note-using
>> program to load/copy the notes into memory with appropriate alignment.
>> I guess a lot of the contents of core elf notes are register dumps and
>> so on, so debuggers must be already dealing with this.
>
> Someone apparently thought that 32-bit alignment was a good thing and
> put it in the spec for the 32-bit format. You argue that most programs
> copy instead of mmap() which sounds correct, but if someone wants to
> mmap() then our current 32-bit aligned 64-bit elf note implementation
> is broken. Which may or may not be ok.
>
> So why was 32-bit alignment put in the 32-bit spec? I suspect the
> reason was to support direct access of note contents. Either using
> mmap() or read() and direct access. Remeber that the notes could
> contain anything which may require properly aligned data for direct
> access. I think this was the reason the word size alignment was put in
> the spec for in the first place.
This conversation appears to be about 10 years to late. We have been
providing 32bit alignment on 64bit platforms in the ELF notes since
they were introduced. x86 is the last architecture to go 64bit.
Even readelf.c assumes notes are always 32bit aligned in their data segment.
If we were doing it from scratch there are clearly some decent reasons for
providing 64bit alignment of the descr field. Those reasons may be
offset by the needless incompatibility between 32bit and 64bit notes
but that doesn't matter at this point.
The reality on the ground is 32bit alignment. Doing anything else would
be ABI breakage. Breaking the ABI of our core files and thus gdb and the
rest of the tools just to conform to some draft spec is daft.
The advantage is not worth it. None of this stuff is on a fast path
anyway.
At this point the right solution is to amend the lsb so it clearly
specifies what the existing practice is. So people don't read the
inconsistent specification and get confused.
Eric
next prev parent reply other threads:[~2006-11-13 3:05 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-02 10:19 [PATCH 01/02] Elf: Always define elf_addr_t in linux/elf.h Magnus Damm
2006-11-02 10:19 ` [PATCH 02/02] Elf: Align elf notes properly Magnus Damm
2006-11-09 14:00 ` Eric W. Biederman
2006-11-10 0:50 ` Horms
2006-11-10 4:00 ` Magnus Damm
2006-11-10 23:37 ` Jeremy Fitzhardinge
2006-11-10 23:39 ` David Miller
2006-11-11 0:26 ` Jeremy Fitzhardinge
2006-11-11 0:43 ` David Miller
2006-11-11 1:20 ` Jeremy Fitzhardinge
2006-11-13 2:16 ` Magnus Damm
2006-11-13 3:03 ` Eric W. Biederman [this message]
2006-11-13 0:23 ` Horms
2006-11-13 1:47 ` David Miller
2006-11-10 3:52 ` Magnus Damm
2006-11-10 5:09 ` Eric W. Biederman
2006-11-10 6:53 ` Magnus Damm
2006-11-10 14:49 ` Vivek Goyal
2006-11-10 16:04 ` Dave Anderson
2006-11-10 16:10 ` Eric W. Biederman
2006-11-10 23:39 ` Jeremy Fitzhardinge
2006-11-02 10:43 ` [PATCH 01/02] Elf: Always define elf_addr_t in linux/elf.h Jakub Jelinek
2006-11-02 10:51 ` Magnus Damm
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=m1irhkt5dp.fsf@ebiederm.dsl.xmission.com \
--to=ebiederm@xmission.com \
--cc=ak@muc.de \
--cc=anderson@redhat.com \
--cc=davem@davemloft.net \
--cc=fastboot@lists.osdl.org \
--cc=horms@verge.net.au \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=magnus@valinux.co.jp \
--cc=vgoyal@in.ibm.com \
/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