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

Re: What integer type should ELF note header have?



Hi,

Note that gnu-gabi drops HTML emails. Please use plain text.

On Fri, 2017-12-22 at 03:49 -0800, H.J. Lu wrote:
> On Dec 22, 2017 6:22 AM, "Mark Wielaard" <mark@klomp.org> wrote:
> > It is not really OK. I have seen code that marks an ELF file as
> > invalid and/or gives up processing ELF notes if it contains notes 
> > that don't follow the standard 4-byte alignment/layout rules.
> > So this really impacts any tool that processes any ELF note.
> 
> The unfixed tools won't be able to understand the property
> note, one way or the other. The real question if all note consumers
> should be updated to check the note alignment specified by
> section/segment header.
> When they are updated, what should they do
> if they see 0,1,4,8 alignment?

That is not the real question. Of course if you introduce a new note
type or a new note section/segment type existing users need to be
updated to take advantage of the new type. But you are proposing to
stuff data into SHT_NOTE sections/PT_NOTE segments that cannot be
parsed at all without changes. So to existing tools it is just an
invalid ELF file with garbage data. That is the problem.

The real question is why you need a new note data layout. If the answer
to that is really that you cannot use the existing structure then the
real question is where we are going to store your new data layout. It
shouldn't go into a SHT_NOTE section or PT_NOTE segment, because that
will break existing tools. But we could certainly introduce SHT_NOTE64
and PT_NOTE64 to store such new note types.

> > The simplest really is to just use the normal note
> > alignment/layout. This seems to be what Fedora rawhide toolchain
> > currently does for NT_GNU_PROPERTY_TYPE_0. That way all tools can
> > process the note and the only thing you need to be careful for is
> > that some values in the note descriptor might not be naturally
> > aligned. This really shouldn't be an issue, especially not if this
> > is x86-only anyway.
> 
> The specification isn't x86 specific.

What in the specification requires you to change the existing ELF note
data layout? It seems the current layout as used in Fedora rawhide
works just fine. You keep saying you like to have naturally aligned
data in the note description. And I agree that would be a nice to have.
But it seems hardly so important to break the current format.

Cheers,

Mark