On Sun, 2021-11-21 at 19:43 +0000, luca.bocca...@gmail.com wrote: > From: Luca Boccassi <bl...@debian.org> > > 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.bocca...@microsoft.com> > --- > v2: check that note payload is NULL terminated > > libebl/eblobjnote.c | 3 +++ > libebl/eblobjnotetypename.c | 3 +++ > libelf/elf.h | 3 +++ > 3 files changed, 9 insertions(+) > > diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c > index 36efe275..e3ad1409 100644 > --- a/libebl/eblobjnote.c > +++ b/libebl/eblobjnote.c > @@ -288,6 +288,9 @@ 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 == 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; > diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c > index 4662906d..863f20e4 100644 > --- a/libebl/eblobjnotetypename.c > +++ b/libebl/eblobjnotetypename.c > @@ -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 == FDO_PACKAGING_METADATA) > + return "FDO_PACKAGING_METADATA"; > + > if (strcmp (name, "GNU") != 0) > { > /* NT_VERSION is special, all data is in the name. */ > diff --git a/libelf/elf.h b/libelf/elf.h > index 8e3e618f..633f9f67 100644 > --- a/libelf/elf.h > +++ b/libelf/elf.h > @@ -1297,6 +1297,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"
Hi Mark, I could move this definition to an internal header if the change to elf.h blocks this patch, if you prefer? Let me know. -- Kind regards, Luca Boccassi
signature.asc
Description: This is a digitally signed message part