Re: [PATCH] elf(5): document notes

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

 



On 18 Nov 2016 08:25, Michael Kerrisk (man-pages) wrote:
> On 11/17/2016 09:59 PM, Mike Frysinger wrote:
> > for documenting the Elf{32,64}_Nhdr structure,
> > the sections/segments that contain notes, and how to interpret them.  I've
> > been lazy and only included the GNU extensions here, 
> 
> Any chance you include the non-GNU stuff also? Or, failing that,
> some clear statements at appropriate points about what is not 
> documented.

the trouble i was running into is that the man pages says it documents
the elf.h header, but the one installed by glibc doesn't have defines
for all the non-GNU stuff.  so if i put in details about the FreeBSD
namespace, it'll have defines like NT_FREEBSD_THRMISC.  none of those
show up in the current elf.h though so people will get errors.

i'm fine with that though if you are.

> > +Note sections contain a series of notes (see the structs below).
> > +Each note is followed by the name field (whose length is defined in
> > +\fIn_namesz\fR) and then by the desc field (whose length is defined in
> > +\fIn_descsz\fR).
> 
> I think this could be a little clearer. I presume that the way things look is
> 
>      struct {} Nhdr
>      <name>\0
>      <desc>\0
> 
> ?

i don't think desc is NUL terminated, but otherwise, yes.

> Maybe shos something like that in the text?

i couldn't find any precedent to copy :).  i didn't want to put it into
the struct def since those fields aren't in the struct, they're implicit
in memory.

how about i put a small snippet of C that'd show how to extract things ?

	void *memory, *name, *desc;
	Elf64_Nhdr *note, *next_note;

	note = memory;
	name = note->n_namesz == 0 ? NULL : memory + sizeof(*note);
	desc = note->n_descsz == 0 ? NULL : name + note->n_namesz;
	next_note = memory + sizeof(*note) + note->n_namesz + note->n_descsz;

> > +Keep in mind that the interpretation of
> > +.I n_type
> > +depends on the namespace defined by the
> > +.I n_namesz
> > +field.
> > +After, of course, whether the ELF image has been determined to be a core.
> 
> I can't understand that last sentence...

i meant that the namespaces are for non-core files, but i'll double check
that is the case.

i snipped all the comments that i'll integrate so i don't have to just
keep saying "OK" over and over :).
-mike

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux