public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] readelf: recognize FDO Packaging Metadata ELF note
@ 2021-11-19  1:03 luca.boccassi
  2021-11-25 11:08 ` Nick Clifton
  0 siblings, 1 reply; 6+ messages in thread
From: luca.boccassi @ 2021-11-19  1:03 UTC (permalink / raw)
  To: binutils

From: Luca Boccassi <luca.boccassi@microsoft.com>

As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/
this note will be used starting from Fedora 36. Allow
readelf --notes to pretty print it:

Displaying notes found in: .note.package
  Owner                Data size 	Description
  FDO                  0x00000039	FDO_PACKAGING_METADATA
    Packaging Metadata: {"type":"deb","name":"fsverity-utils","version":"1.3-1"}

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
---
 binutils/readelf.c   | 12 ++++++++++++
 include/elf/common.h |  3 +++
 2 files changed, 15 insertions(+)

diff --git a/binutils/readelf.c b/binutils/readelf.c
index 116f879c892..3ed45f87332 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -19197,6 +19197,8 @@ get_note_type (Filedata * filedata, unsigned e_type)
 	return _("func");
       case NT_GO_BUILDID:
 	return _("GO BUILDID");
+      case FDO_PACKAGING_METADATA:
+	return _("FDO_PACKAGING_METADATA");
       default:
 	break;
       }
@@ -20407,6 +20409,14 @@ print_stapsdt_note (Elf_Internal_Note *pnote)
   return false;
 }
 
+static bool
+print_fdo_note (Elf_Internal_Note *pnote)
+{
+  if (pnote->descsz > 0 && pnote->type == FDO_PACKAGING_METADATA)
+    printf (_("    Packaging Metadata: %.*s\n"), (int) pnote->descsz, pnote->descdata);
+  return true;
+}
+
 static const char *
 get_ia64_vms_note_type (unsigned e_type)
 {
@@ -21140,6 +21150,8 @@ process_note (Elf_Internal_Note *  pnote,
     return print_stapsdt_note (pnote);
   else if (startswith (pnote->namedata, "CORE"))
     return print_core_note (pnote);
+  else if (startswith (pnote->namedata, "FDO"))
+    return print_fdo_note (pnote);
   else if (((startswith (pnote->namedata, "GA")
 	     && strchr ("*$!+", pnote->namedata[2]) != NULL)
 	    || strchr ("*$!+", pnote->namedata[0]) != NULL)
diff --git a/include/elf/common.h b/include/elf/common.h
index 5d31e35ec89..c8331a76e3d 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -997,6 +997,9 @@
 
 #define NT_FREEBSD_ABI_TAG	1
 
+/* Values for FDO .note.package notes as defined on https://systemd.io/COREDUMP_PACKAGE_METADATA/  */
+#define FDO_PACKAGING_METADATA 0xcafe1a7e
+
 /* These three macros disassemble and assemble a symbol table st_info field,
    which contains the symbol binding and symbol type.  The STB_ and STT_
    defines identify the binding and type.  */
-- 
2.30.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] readelf: recognize FDO Packaging Metadata ELF note
  2021-11-19  1:03 [PATCH] readelf: recognize FDO Packaging Metadata ELF note luca.boccassi
@ 2021-11-25 11:08 ` Nick Clifton
  2021-12-01 12:40   ` Luca Boccassi
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Clifton @ 2021-11-25 11:08 UTC (permalink / raw)
  To: luca.boccassi, binutils

Hi Luca,

> As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/
> this note will be used starting from Fedora 36. Allow
> readelf --notes to pretty print it:
> 
> Displaying notes found in: .note.package
>    Owner                Data size 	Description
>    FDO                  0x00000039	FDO_PACKAGING_METADATA
>      Packaging Metadata: {"type":"deb","name":"fsverity-utils","version":"1.3-1"}
> 

Approved - please apply.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] readelf: recognize FDO Packaging Metadata ELF note
  2021-11-25 11:08 ` Nick Clifton
@ 2021-12-01 12:40   ` Luca Boccassi
  2021-12-01 14:45     ` Nick Clifton
  0 siblings, 1 reply; 6+ messages in thread
From: Luca Boccassi @ 2021-12-01 12:40 UTC (permalink / raw)
  To: Nick Clifton, binutils

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

On Thu, 2021-11-25 at 11:08 +0000, Nick Clifton wrote:
> Hi Luca,
> 
> > As defined on: https://systemd.io/COREDUMP_PACKAGE_METADATA/
> > this note will be used starting from Fedora 36. Allow
> > readelf --notes to pretty print it:
> > 
> > Displaying notes found in: .note.package
> >    Owner                Data size 	Description
> >    FDO                  0x00000039	FDO_PACKAGING_METADATA
> >      Packaging Metadata: {"type":"deb","name":"fsverity-utils","version":"1.3-1"}
> > 
> 
> Approved - please apply.
> 
> Cheers
>    Nick

Thank you - any update on committing it?

-- 
Kind regards,
Luca Boccassi

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] readelf: recognize FDO Packaging Metadata ELF note
  2021-12-01 12:40   ` Luca Boccassi
@ 2021-12-01 14:45     ` Nick Clifton
  2021-12-01 15:47       ` Luca Boccassi
  0 siblings, 1 reply; 6+ messages in thread
From: Nick Clifton @ 2021-12-01 14:45 UTC (permalink / raw)
  To: Luca Boccassi, binutils

Hi Luca,

>> Approved - please apply.

(That was a hint to suggest that you could apply the patch yourself).


> Thank you - any update on committing it?

Done. :-)

Cheers
   Nick



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] readelf: recognize FDO Packaging Metadata ELF note
  2021-12-01 14:45     ` Nick Clifton
@ 2021-12-01 15:47       ` Luca Boccassi
  2021-12-01 16:18         ` Nick Clifton
  0 siblings, 1 reply; 6+ messages in thread
From: Luca Boccassi @ 2021-12-01 15:47 UTC (permalink / raw)
  To: Nick Clifton, binutils

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

On Wed, 2021-12-01 at 14:45 +0000, Nick Clifton wrote:
> Hi Luca,
> 
> > > Approved - please apply.
> 
> (That was a hint to suggest that you could apply the patch yourself).

Oh sorry, didn't get that - but I'm not a maintainer so I don't think I
can do that?

> > Thank you - any update on committing it?
> 
> Done. :-)

Thank you!

But looks like there was some fuzz or something like that? One part got
applied in the wrong section - from the original email:

@@ -19197,6 +19197,8 @@ get_note_type (Filedata * filedata, unsigned e_type)
 	return _("func");
       case NT_GO_BUILDID:
 	return _("GO BUILDID");
+      case FDO_PACKAGING_METADATA:
+	return _("FDO_PACKAGING_METADATA");
       default:
 	break;
       }

Applied:

@@ -19220,6 +19220,8 @@ get_note_type (Filedata * filedata, unsigned e_type)
        return _("NT_SIGINFO (siginfo_t data)");
       case NT_FILE:
        return _("NT_FILE (mapped files)");
+      case FDO_PACKAGING_METADATA:
+       return _("FDO_PACKAGING_METADATA");
       default:
        break;
       }

But the latter doesn't work, as it's for ELF exec/libs rather than
corefiles:

    Displaying notes found in: .note.package
      Owner                Data size        Description
      FDO                  0x00000039       Unknown note type: (0xcafe1a7e)
        Packaging Metadata: {"type":"deb","name":"fsverity-utils","version":"1.3-1"}


But it's an easy fix, sent a follow-up:

https://sourceware.org/pipermail/binutils/2021-December/118746.html

-- 
Kind regards,
Luca Boccassi

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] readelf: recognize FDO Packaging Metadata ELF note
  2021-12-01 15:47       ` Luca Boccassi
@ 2021-12-01 16:18         ` Nick Clifton
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2021-12-01 16:18 UTC (permalink / raw)
  To: Luca Boccassi, binutils

Hi Luca,

> Oh sorry, didn't get that - but I'm not a maintainer so I don't think I
> can do that?

Actually anyone with write permission can apply patches, although they
do need to be reviewed and approved first, of course.  If you do not
have write permission then an email like the one you sent will do...


> But it's an easy fix, sent a follow-up:
> 
> https://sourceware.org/pipermail/binutils/2021-December/118746.html

Doh - sorry - fixed.

Cheers
   Nick



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-12-01 16:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19  1:03 [PATCH] readelf: recognize FDO Packaging Metadata ELF note luca.boccassi
2021-11-25 11:08 ` Nick Clifton
2021-12-01 12:40   ` Luca Boccassi
2021-12-01 14:45     ` Nick Clifton
2021-12-01 15:47       ` Luca Boccassi
2021-12-01 16:18         ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).