Re: Storing package metadata in ELF objects
Hi Luca,
On Tue, 2021-05-04 at 14:43 +0100, Luca Boccassi wrote:
> On Fri, 2021-04-30 at 19:57 +0200, Mark Wielaard wrote:
> > Is there a list of default keys (and their canonical spelling, upper-
> > lower-Camel_Case, etc.)? If there is, could we have a "debuginfod" key
> > with as value an URL pointing to the debuginfod server URL where the
> > embedded build-id executable, debuginfo and sources can be found?
> > https://sourceware.org/elfutils/Debuginfod.html
>
> The "Implementation" section of the spec lists the "main" fields:
>
> https://systemd.io/COREDUMP_PACKAGE_METADATA/
>
> (source for that is https://github.com/systemd/systemd/blob/main/docs/COREDUMP_PACKAGE_METADATA.md )
>
> Would you like to send a PR to update it and add that field?
Sorry, I don't have a github account. But attached is a patch for to
document it and one for the package-notes generator to add an --
debuginfod argument (maybe the distro should set a default value for
that?) Hopefully those patches could be applied somehow.
Thanks,
Mark
From 176dde09fcfeff9bff97fbf65d47a641dbd2fa3a Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Thu, 6 May 2021 03:05:02 +0200
Subject: [PATCH] docs/COREDUMP_PACKAGE_METADATA.md: Add debuginfod key
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
docs/COREDUMP_PACKAGE_METADATA.md | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/docs/COREDUMP_PACKAGE_METADATA.md b/docs/COREDUMP_PACKAGE_METADATA.md
index ab7c4596de..b7be9ca797 100644
--- a/docs/COREDUMP_PACKAGE_METADATA.md
+++ b/docs/COREDUMP_PACKAGE_METADATA.md
@@ -26,6 +26,10 @@ Thus it becomes desirable to add additional metadata to a binary at build time,
`systemd-coredump` and other services analyzing core files are able to extract said
metadata simply from the core file itself, without external dependencies.
+And in case external dependencies and network are available the core file
+should also include the debuginfod server URL that can provide the original
+executable, debuginfo and sources to facilitate debugging.
+
## Implementation
This document will attempt to define a common metadata format specification, so that
@@ -58,6 +62,7 @@ Value: a JSON string with the structure described below
"name":"coreutils",
"version": "4711.0815.fc13.arm32",
"osCpe": # A CPE name for the operating system, `CPE_NAME` from os-release is a good default
+ "debuginfod": "https://debuginfod.fedoraproject.org"
}
```
--
2.18.4
From 6264605699cbac02ed3060cc1ff6497b32e90382 Mon Sep 17 00:00:00 2001
From: Mark Wielaard <mark@klomp.org>
Date: Thu, 6 May 2021 03:13:57 +0200
Subject: [PATCH] generate-package-notes.py: Add --debuginfod argument
Signed-off-by: Mark Wielaard <mark@klomp.org>
---
generate-package-notes.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/generate-package-notes.py b/generate-package-notes.py
index c0b5d98..92126f7 100755
--- a/generate-package-notes.py
+++ b/generate-package-notes.py
@@ -71,6 +71,7 @@ def parse_args():
p.add_argument('--package-version')
p.add_argument('--cpe')
p.add_argument('--rpm', metavar='NEVRA')
+ p.add_argument('--debuginfod')
opts = p.parse_args()
@@ -143,6 +144,8 @@ def generate_section(opts):
else:
data['os'] = read_os_release('ID')
data['osVersion'] = read_os_release('VERSION_ID')
+ if opts.debuginfod:
+ data['debuginfod'] = opts.debuginfod
json = json_serialize(data)
--
2.18.4
Reply to: