mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Magnus Damm" <magnus.damm@gmail.com>
To: Horms <horms@verge.net.au>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	"Magnus Damm" <magnus@valinux.co.jp>,
	linux-kernel@vger.kernel.org, "Vivek Goyal" <vgoyal@in.ibm.com>,
	"Andi Kleen" <ak@muc.de>,
	fastboot@lists.osdl.org, "Dave Anderson" <anderson@redhat.com>
Subject: Re: [PATCH 02/02] Elf: Align elf notes properly
Date: Fri, 10 Nov 2006 13:00:09 +0900	[thread overview]
Message-ID: <aec7e5c30611092000k397fb578xc59a990043fc310a@mail.gmail.com> (raw)
In-Reply-To: <20061110005051.GB4107@verge.net.au>

On 11/10/06, Horms <horms@verge.net.au> wrote:
> On Thu, Nov 09, 2006 at 07:00:22AM -0700, Eric W. Biederman wrote:
> > Magnus Damm <magnus@valinux.co.jp> writes:
> >
> > > elf: Align elf notes properly
> > >
> > > The kernel currently contains several elf note aligment implementations. Most
> > > implementations follow the spec on 32-bit platforms, but none current aligns
> > > the notes correctly on 64-bit platforms. This patch tries to fix this by
> > > interpreting the 64-bit and 32-bit elf specs as the following:
> > >
> > > offset bytes name
> > > 0      4     n_namesz -+                  -+
> > > 4      4     n_descsz  | elf note header   |
> > > 8      4     n_type   -+                   | elf note entry size - N4
> > > 12     N1    name                          |
> > > N2     N3    desc                         -+
> > >
> > > WS = word size in bytes (4 for 32 bit, 8 for 64 bit)
> > > N1 = roundup(n_namesz + sizeof(elf note header), WS) - sizeof(elf note header)
> > > N2 = sizeof(elf note header) + N1
> > > N3 = roundup(n_descsz, WS)
> > > N4 = sizeof(elf note header) + N1 + N2
> > >
> > > The elf note header contains three 32-bit values on 32-bit and 64-bit systems.
> > > The header is followed by name and desc data together with padding. The
> > > alignment and padding varies depending on the word size.
> >
> > I see your point and I disagree.  The notes in a kernel generated
> > core dump do not vary in size.  Find me some implementation evidence that
> > anyone ever added the extra 4 bytes of alignment to the description and the
> > padding fields and I will be ready to consider this.  Currently this
> > just appears to be reading a draft spec that doesn't match reality.
>
> Or perhaps a spec that hasn't been implemented correctly.
> I guess that the real question is, what padding is correct?

I see no point in aligning to 32-bit boundaries on 64-bit platforms.
Their intention was most likely to align to the word size IMO, so this
is most likely a "thinko" left over from whoever ported the code from
32-bit to 64-bit.

How we chose to align on 64-bit platforms is another issue, either we
fix it soon or live with the fact that we are not following the 64-bit
draft spec. Either way is fine with me.

/ magnus

  reply	other threads:[~2006-11-10  4:00 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 [this message]
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
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=aec7e5c30611092000k397fb578xc59a990043fc310a@mail.gmail.com \
    --to=magnus.damm@gmail.com \
    --cc=ak@muc.de \
    --cc=anderson@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=fastboot@lists.osdl.org \
    --cc=horms@verge.net.au \
    --cc=linux-kernel@vger.kernel.org \
    --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

all inboxes | Powered by JetHome®