From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 03B7F3858D3C for ; Sun, 21 Nov 2021 16:33:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 03B7F3858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x10.wildebeest.org [172.31.17.146]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 7F38A3000346; Sun, 21 Nov 2021 17:33:28 +0100 (CET) Received: by reform (Postfix, from userid 1000) id 117592E80467; Sun, 21 Nov 2021 17:33:12 +0100 (CET) Date: Sun, 21 Nov 2021 17:33:12 +0100 From: Mark Wielaard To: luca.boccassi@gmail.com Cc: elfutils-devel@sourceware.org Subject: Re: [PATCH] libebl: recognize FDO Packaging Metadata ELF note Message-ID: References: <20211119003127.466778-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211119003127.466778-1-luca.boccassi@gmail.com> X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2021 16:33:34 -0000 Hi Luca, On Fri, Nov 19, 2021 at 12:31:27AM +0000, luca.boccassi--- via Elfutils-devel wrote: > From: Luca Boccassi > > 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"} Very nice. Thanks, > diff --git a/libebl/eblobjnote.c b/libebl/eblobjnote.c > index 36efe275..1f8bcccf 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) > + printf(" Packaging Metadata: %.*s\n", (int) descsz, desc); > + We might want to check that the desc is '\0' terminated (although I see we also don't do that in other cases, like NT_GNU_GOLD_VERSION. But it might be good as a robustness check. > 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" Would you mind posting the elf.h patch to glibc-alpha@sourceware.org. We normally sync elf.h with the glibc one. It will also make sure other users of elf.h also get the new constants. As a followup I wouldn't mind a minimal testcase. Especially if it contains a debuginfod url. We would have to think how to integrate that with libdw dwfl_build_id_find_elf and dwfl_standard_find_debuginfo which use debuginfod_find from the debuginfod-client library. Since the payload of the FDO_PACKAGING_METADATA note are not simply key/values, but encoded in json, so we will need to add or depend on a json parser. Any recommendations? It seems a simple enough format to just write our own (especially if we can simply skip everything except top-level key/value strings to find the debuginfod-url). Thanks, Mark