elf: add definition for FDO_PACKAGING_METADATA note

Message ID 20211121193939.105186-1-luca.boccassi@gmail.com
State Superseded
Headers
Series elf: add definition for FDO_PACKAGING_METADATA note |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

develop--- via Libc-alpha Nov. 21, 2021, 7:39 p.m. UTC
  From: Luca Boccassi <bluca@debian.org>

As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/
this note will be used starting from Fedora 36.

Signed-off-by: Luca Boccassi <bluca@debian.org>
---
As requested by Mark on:
https://sourceware.org/pipermail/elfutils-devel/2021q4/004387.html

 elf/elf.h | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Florian Weimer Nov. 22, 2021, 2:03 p.m. UTC | #1
* luca boccassi:

> From: Luca Boccassi <bluca@debian.org>
>
> As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/
> this note will be used starting from Fedora 36.
>
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> As requested by Mark on:
> https://sourceware.org/pipermail/elfutils-devel/2021q4/004387.html
>
>  elf/elf.h | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/elf/elf.h b/elf/elf.h
> index 50f87bac..4bb390b2 100644
> --- a/elf/elf.h
> +++ b/elf/elf.h
> @@ -1302,6 +1302,9 @@ typedef struct
>  /* Program property.  */
>  #define NT_GNU_PROPERTY_TYPE_0 5
>  
> +/* Packaging metadata as defined on https://systemd.io/COREDUMP_PACKAGE_METADATA/ */
> +#define FDO_PACKAGING_METADATA 0xcafe1a7e

Given that this is in the "FDO" namespace, do we have to document this?
Do you have your own registry for this?

Thanks,
Florian
  
Luca Boccassi Nov. 22, 2021, 2:44 p.m. UTC | #2
On Mon, 2021-11-22 at 15:03 +0100, Florian Weimer wrote:
> * luca boccassi:
> 
> > From: Luca Boccassi <bluca@debian.org>
> > 
> > As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/
> > this note will be used starting from Fedora 36.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> > As requested by Mark on:
> > https://sourceware.org/pipermail/elfutils-devel/2021q4/004387.html
> > 
> >  elf/elf.h | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/elf/elf.h b/elf/elf.h
> > index 50f87bac..4bb390b2 100644
> > --- a/elf/elf.h
> > +++ b/elf/elf.h
> > @@ -1302,6 +1302,9 @@ typedef struct
> >  /* Program property.  */
> >  #define NT_GNU_PROPERTY_TYPE_0 5
> >  
> > +/* Packaging metadata as defined on
> > https://systemd.io/COREDUMP_PACKAGE_METADATA/ */
> > +#define FDO_PACKAGING_METADATA 0xcafe1a7e
> 
> Given that this is in the "FDO" namespace, do we have to document this?

Hi,

This change was requested by the maintainer of elfutils (CC'ed):

https://sourceware.org/pipermail/elfutils-devel/2021q4/004387.html

I've sent a similar change for binutils' readelf:

https://sourceware.org/pipermail/binutils/2021-November/118584.html

We'll be using this ID through various projects, so IMHO it would be
useful to document it, yes.

> Do you have your own registry for this?

Sorry, what do you mean by registry here? A public header? If so, then
no we do not AFAIK.
  
Florian Weimer Nov. 22, 2021, 3:17 p.m. UTC | #3
* Luca Boccassi:

>> Do you have your own registry for this?
>
> Sorry, what do you mean by registry here? A public header? If so, then
> no we do not AFAIK.

A means for avoiding tag number collisions under the "FDO" namespace.

glibc <elf.h> only covers a small subset of the note section names.  The
Solaris is probably not up to date, and we do not track FreeBSD and
NetBSD at all.  (FreeBSD definitely has a bunch of their own tags.)

We can add it to our own <elf.h>, but the extension mechanism with its
namespace mechanism means that we don't have to.

Thanks,
Florian
  
Mark Wielaard Nov. 23, 2021, 9:42 a.m. UTC | #4
Hi,

On Mon, 2021-11-22 at 16:17 +0100, Florian Weimer wrote:
> * Luca Boccassi:
> 
> > > Do you have your own registry for this?
> > 
> > Sorry, what do you mean by registry here? A public header? If so, then
> > no we do not AFAIK.
> 
> A means for avoiding tag number collisions under the "FDO" namespace.
> 
> glibc <elf.h> only covers a small subset of the note section names.  The
> Solaris is probably not up to date, and we do not track FreeBSD and
> NetBSD at all.  (FreeBSD definitely has a bunch of their own tags.)
> 
> We can add it to our own <elf.h>, but the extension mechanism with its
> namespace mechanism means that we don't have to.

I thing freedesktop.org (FDO) didn't know they could register a new
constant under the GNU ELF notes namespace. But it really is just a
companion note to NT_GNU_BUILD_ID in the GNU namespace. So it would be
really convenient if it gets into the glibc elf.h so that others can
pick it up and use it.

Cheers,

Mark
  
Mark Wielaard Nov. 26, 2021, 4:49 p.m. UTC | #5
Hi Luca,

On Sun, 2021-11-21 at 19:39 +0000, luca.boccassi@gmail.com wrote:
> From: Luca Boccassi <bluca@debian.org>
> 
> As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/
> this note will be used starting from Fedora 36.
> 
> Signed-off-by: Luca Boccassi <bluca@debian.org>
> ---
> As requested by Mark on:
> https://sourceware.org/pipermail/elfutils-devel/2021q4/004387.html
> 
>  elf/elf.h | 3 +++
>  1 file changed, 3 insertions(+)

Two small nitpicks.

> diff --git a/elf/elf.h b/elf/elf.h
> index 50f87bac..4bb390b2 100644
> --- a/elf/elf.h
> +++ b/elf/elf.h
> @@ -1302,6 +1302,9 @@ typedef struct
>  /* Program property.  */
>  #define NT_GNU_PROPERTY_TYPE_0 5
>  
> +/* Packaging metadata as defined on https://systemd.io/COREDUMP_PACKAGE_METADATA/ */

This comment is a little too wide.

> +#define FDO_PACKAGING_METADATA 0xcafe1a7e

This doesn't follow the naming scheme of the other note types. Could we
use NT_FDO_PACKAGING_METADATA?

>  /* Note section name of program property.   */
>  #define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property"

Reformatted patch attached.

Thanks,

Mark
  
Luca Boccassi Nov. 26, 2021, 5:01 p.m. UTC | #6
On Fri, 2021-11-26 at 17:49 +0100, Mark Wielaard wrote:
> Hi Luca,
> 
> On Sun, 2021-11-21 at 19:39 +0000, luca.boccassi@gmail.com wrote:
> > From: Luca Boccassi <bluca@debian.org>
> > 
> > As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/
> > this note will be used starting from Fedora 36.
> > 
> > Signed-off-by: Luca Boccassi <bluca@debian.org>
> > ---
> > As requested by Mark on:
> > https://sourceware.org/pipermail/elfutils-devel/2021q4/004387.html
> > 
> >  elf/elf.h | 3 +++
> >  1 file changed, 3 insertions(+)
> 
> Two small nitpicks.
> 
> > diff --git a/elf/elf.h b/elf/elf.h
> > index 50f87bac..4bb390b2 100644
> > --- a/elf/elf.h
> > +++ b/elf/elf.h
> > @@ -1302,6 +1302,9 @@ typedef struct
> >  /* Program property.  */
> >  #define NT_GNU_PROPERTY_TYPE_0 5
> >  
> > 
> > +/* Packaging metadata as defined on https://systemd.io/COREDUMP_PACKAGE_METADATA/ */
> 
> This comment is a little too wide.
> 
> > +#define FDO_PACKAGING_METADATA 0xcafe1a7e
> 
> This doesn't follow the naming scheme of the other note types. Could we
> use NT_FDO_PACKAGING_METADATA?
> 
> >  /* Note section name of program property.   */
> >  #define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property"
> 
> Reformatted patch attached.
> 
> Thanks,
> 
> Mark

Thank you, sent v2 as suggested.
  

Patch

diff --git a/elf/elf.h b/elf/elf.h
index 50f87bac..4bb390b2 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -1302,6 +1302,9 @@  typedef struct
 /* Program property.  */
 #define NT_GNU_PROPERTY_TYPE_0 5
 
+/* Packaging metadata as defined on https://systemd.io/COREDUMP_PACKAGE_METADATA/ */
+#define FDO_PACKAGING_METADATA 0xcafe1a7e
+
 /* Note section name of program property.   */
 #define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property"