From: Luca Boccassi <bl...@debian.org> Note that the webpage in the comment is not published yet, it will be next week when the next systemd RC is tagged. The document can be viewed right now on github at: https://github.com/systemd/systemd/blob/main/docs/ELF_DLOPEN_METADATA.md
But the node ID and the string format are now fixed, even if the content of the string might change, it will still be a string. Signed-off-by: Luca Boccassi <bl...@debian.org> --- libebl/eblobjnote.c | 9 +++++++-- libebl/eblobjnotetypename.c | 3 +++ libelf/elf.h | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c index 1ba5d8b3..ad3f49de 100644 --- a/libebl/eblobjnote.c +++ b/libebl/eblobjnote.c @@ -288,9 +288,14 @@ 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 + if (strcmp ("FDO", name) == 0 && descsz > 0 && desc[descsz - 1] == '\0') - printf(" Packaging Metadata: %.*s\n", (int) descsz, desc); + { + if (type == NT_FDO_PACKAGING_METADATA) + printf(" Packaging Metadata: %.*s\n", (int) descsz, desc); + else if (type == NT_FDO_DLOPEN_METADATA) + printf(" Dlopen Metadata: %.*s\n", (int) descsz, desc); + } /* Everything else should have the "GNU" owner name. */ if (strcmp ("GNU", name) != 0) diff --git a/libebl/eblobjnotetypename.c b/libebl/eblobjnotetypename.c index 473a1f2f..79ff010a 100644 --- a/libebl/eblobjnotetypename.c +++ b/libebl/eblobjnotetypename.c @@ -104,6 +104,9 @@ ebl_object_note_type_name (Ebl *ebl, const char *name, uint32_t type, if (strcmp (name, "FDO") == 0 && type == NT_FDO_PACKAGING_METADATA) return "FDO_PACKAGING_METADATA"; + if (strcmp (name, "FDO") == 0 && type == NT_FDO_DLOPEN_METADATA) + return "FDO_DLOPEN_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 f2206e5c..bbf4565c 100644 --- a/libelf/elf.h +++ b/libelf/elf.h @@ -1336,6 +1336,10 @@ typedef struct https://systemd.io/COREDUMP_PACKAGE_METADATA/ */ #define NT_FDO_PACKAGING_METADATA 0xcafe1a7e +/* dlopen metadata as defined on + https://systemd.io/ELF_DLOPEN_METADATA/ */ +#define NT_FDO_DLOPEN_METADATA 0x407c0c0a + /* Note section name of program property. */ #define NOTE_GNU_PROPERTY_SECTION_NAME ".note.gnu.property" -- 2.39.2