All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
To: "Michael Kerrisk (man-pages)"
	<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] elf(5): document notes
Date: Fri, 18 Nov 2016 10:25:47 -0800	[thread overview]
Message-ID: <20161118182547.GY21655@vapier.lan> (raw)
In-Reply-To: <2dbf5664-524e-9411-16f4-2a84e6395c82-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2351 bytes --]

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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2016-11-18 18:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17 20:59 [PATCH] elf(5): document notes Mike Frysinger
     [not found] ` <20161117205939.2295-1-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2016-11-18  7:25   ` Michael Kerrisk (man-pages)
     [not found]     ` <2dbf5664-524e-9411-16f4-2a84e6395c82-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-18 18:25       ` Mike Frysinger [this message]
     [not found]         ` <20161118182547.GY21655-UgUKS2FnFs9+urZeOPWqwQ@public.gmane.org>
2016-11-19 10:13           ` Michael Kerrisk (man-pages)
     [not found]             ` <CAKgNAkgqWayEyq5iej=+2y+uyD9BsLNDNHhAC539L955aet56w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-11-27  3:32               ` Mike Frysinger
     [not found]                 ` <20161127033225.GU21655-UgUKS2FnFs9+urZeOPWqwQ@public.gmane.org>
2016-11-27 11:01                   ` Michael Kerrisk (man-pages)
2016-11-27  3:31   ` [PATCH v2] " Mike Frysinger
     [not found]     ` <20161127033137.31756-1-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2016-11-27 11:00       ` Michael Kerrisk (man-pages)
     [not found]         ` <2645467f-09b8-d2c1-b89f-7b5e52d0b233-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-11-27 18:15           ` Mike Frysinger
     [not found]             ` <20161127181502.GD20966-UgUKS2FnFs9+urZeOPWqwQ@public.gmane.org>
2016-11-28 21:20               ` Michael Kerrisk (man-pages)

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=20161118182547.GY21655@vapier.lan \
    --to=vapier-abrp7r+bbdudnm+yrofe0a@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.