libebl: recognize FDO Packaging Metadata ELF note
authorLuca Boccassi <bluca@debian.org>
Sun, 21 Nov 2021 19:43:18 +0000 (19:43 +0000)
committerMark Wielaard <mark@klomp.org>
Thu, 24 Mar 2022 22:42:36 +0000 (23:42 +0100)
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:

Note section [ 3] '.note.package' of 76 bytes at offset 0x2e8:
  Owner          Data size  Type
  FDO                   57  FDO_PACKAGING_METADATA
    Packaging Metadata: {"type":"deb","name":"fsverity-utils","version":"1.3-1"}

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
libebl/ChangeLog
libebl/eblobjnote.c
libebl/eblobjnotetypename.c

index da690a4..2e31e75 100644 (file)
@@ -1,3 +1,8 @@
+2021-12-21  Luca Boccassi  <bluca@debian.org>
+
+       * eblobjnote.c (ebl_object_note): Handle NT_FDO_PACKAGING_METADATA.
+       * eblobjnotetypename.c (ebl_object_note_type_name): Likewise.
+
 2021-09-06  Dmitry V. Levin  <ldv@altlinux.org>
 
        * eblopenbackend.c (openbackend): Remove cast of calloc return value.
index 36efe27..5a7c5c6 100644 (file)
@@ -288,6 +288,10 @@ ebl_object_note (Ebl *ebl, uint32_t namesz, const char *name, uint32_t type,
       if (descsz == 0 && type == NT_VERSION)
        return;
 
+      if (strcmp ("FDO", name) == 0 && type == NT_FDO_PACKAGING_METADATA
+         && descsz > 0 && desc[descsz - 1] == '\0')
+       printf("    Packaging Metadata: %.*s\n", (int) descsz, desc);
+
       /* Everything else should have the "GNU" owner name.  */
       if (strcmp ("GNU", name) != 0)
        return;
index 4662906..473a1f2 100644 (file)
@@ -101,6 +101,9 @@ ebl_object_note_type_name (Ebl *ebl, const char *name, uint32_t type,
          return buf;
        }
 
+      if (strcmp (name, "FDO") == 0 && type == NT_FDO_PACKAGING_METADATA)
+       return "FDO_PACKAGING_METADATA";
+
       if (strcmp (name, "GNU") != 0)
        {
          /* NT_VERSION is special, all data is in the name.  */