From 2f13844e73b2d063b3cb64ce43fa2d1ec2755046 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 25 Oct 2021 23:09:43 +0100 Subject: [PATCH 1/2] docs/COREDUMP_PACKAGE_METADATA: add architecture field --- docs/COREDUMP_PACKAGE_METADATA.md | 44 ++++++++++++++++++------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/docs/COREDUMP_PACKAGE_METADATA.md b/docs/COREDUMP_PACKAGE_METADATA.md index 9936703c76..1ff10d385d 100644 --- a/docs/COREDUMP_PACKAGE_METADATA.md +++ b/docs/COREDUMP_PACKAGE_METADATA.md @@ -60,7 +60,8 @@ Value: a JSON string with the structure described below "os":"fedora", "osVersion":"33", "name":"coreutils", - "version": "4711.0815.fc13.arm32", + "version":"4711.0815.fc13", + "architecture":"arm32", "osCpe": "cpe:/o:fedoraproject:fedora:33", # A CPE name for the operating system, `CPE_NAME` from os-release is a good default "debugInfoUrl": "https://debuginfod.fedoraproject.org/" } @@ -72,15 +73,15 @@ and can be used to generate a linker script, which can then be used at build tim Generator: ```console -$ ./generate-package-notes.py --rpm systemd-248~rc2-1.fc34 +$ ./generate-package-notes.py --rpm systemd-248~rc2-1.fc33.arm32 --cpe cpe:/o:fedoraproject:fedora:33 SECTIONS { - .note.package : ALIGN(4) { + .note.package (READONLY) : ALIGN(4) { BYTE(0x04) BYTE(0x00) BYTE(0x00) BYTE(0x00) /* Length of Owner including NUL */ - BYTE(0x64) BYTE(0x00) BYTE(0x00) BYTE(0x00) /* Length of Value including NUL */ + BYTE(0x7b) BYTE(0x00) BYTE(0x00) BYTE(0x00) /* Length of Value including NUL */ BYTE(0x7e) BYTE(0x1a) BYTE(0xfe) BYTE(0xca) /* Note ID */ BYTE(0x46) BYTE(0x44) BYTE(0x4f) BYTE(0x00) /* Owner: 'FDO\x00' */ - BYTE(0x7b) BYTE(0x22) BYTE(0x74) BYTE(0x79) /* Value: '{"type":"rpm","name":"systemd","version":"248~rc2-1.fc34","osCpe":"cpe:/o:fedoraproject:fedora:33"}\x00' */ + BYTE(0x7b) BYTE(0x22) BYTE(0x74) BYTE(0x79) /* Value: '{"type":"rpm","name":"systemd","version":"248~rc2-1.fc33","architecture":"arm32","osCpe":"cpe:/o:fedoraproject:fedora:33"}\x00\x00' */ BYTE(0x70) BYTE(0x65) BYTE(0x22) BYTE(0x3a) BYTE(0x22) BYTE(0x72) BYTE(0x70) BYTE(0x6d) BYTE(0x22) BYTE(0x2c) BYTE(0x22) BYTE(0x6e) @@ -93,18 +94,24 @@ SECTIONS BYTE(0x3a) BYTE(0x22) BYTE(0x32) BYTE(0x34) BYTE(0x38) BYTE(0x7e) BYTE(0x72) BYTE(0x63) BYTE(0x32) BYTE(0x2d) BYTE(0x31) BYTE(0x2e) - BYTE(0x66) BYTE(0x63) BYTE(0x33) BYTE(0x34) - BYTE(0x22) BYTE(0x2c) BYTE(0x22) BYTE(0x6f) - BYTE(0x73) BYTE(0x43) BYTE(0x70) BYTE(0x65) - BYTE(0x22) BYTE(0x3a) BYTE(0x22) BYTE(0x63) - BYTE(0x70) BYTE(0x65) BYTE(0x3a) BYTE(0x2f) - BYTE(0x6f) BYTE(0x3a) BYTE(0x66) BYTE(0x65) - BYTE(0x64) BYTE(0x6f) BYTE(0x72) BYTE(0x61) - BYTE(0x70) BYTE(0x72) BYTE(0x6f) BYTE(0x6a) - BYTE(0x65) BYTE(0x63) BYTE(0x74) BYTE(0x3a) - BYTE(0x66) BYTE(0x65) BYTE(0x64) BYTE(0x6f) - BYTE(0x72) BYTE(0x61) BYTE(0x3a) BYTE(0x33) - BYTE(0x33) BYTE(0x22) BYTE(0x7d) BYTE(0x00) + BYTE(0x66) BYTE(0x63) BYTE(0x33) BYTE(0x33) + BYTE(0x22) BYTE(0x2c) BYTE(0x22) BYTE(0x61) + BYTE(0x72) BYTE(0x63) BYTE(0x68) BYTE(0x69) + BYTE(0x74) BYTE(0x65) BYTE(0x63) BYTE(0x74) + BYTE(0x75) BYTE(0x72) BYTE(0x65) BYTE(0x22) + BYTE(0x3a) BYTE(0x22) BYTE(0x61) BYTE(0x72) + BYTE(0x6d) BYTE(0x33) BYTE(0x32) BYTE(0x22) + BYTE(0x2c) BYTE(0x22) BYTE(0x6f) BYTE(0x73) + BYTE(0x43) BYTE(0x70) BYTE(0x65) BYTE(0x22) + BYTE(0x3a) BYTE(0x22) BYTE(0x63) BYTE(0x70) + BYTE(0x65) BYTE(0x3a) BYTE(0x2f) BYTE(0x6f) + BYTE(0x3a) BYTE(0x66) BYTE(0x65) BYTE(0x64) + BYTE(0x6f) BYTE(0x72) BYTE(0x61) BYTE(0x70) + BYTE(0x72) BYTE(0x6f) BYTE(0x6a) BYTE(0x65) + BYTE(0x63) BYTE(0x74) BYTE(0x3a) BYTE(0x66) + BYTE(0x65) BYTE(0x64) BYTE(0x6f) BYTE(0x72) + BYTE(0x61) BYTE(0x3a) BYTE(0x33) BYTE(0x33) + BYTE(0x22) BYTE(0x7d) BYTE(0x00) BYTE(0x00) } } INSERT AFTER .note.gnu.build-id; @@ -121,6 +128,7 @@ A set of well-known keys is defined here, and hopefully shared among all vendors | os | The OS name, typically corresponding to ID in os-release | fedora | | osVersion | The OS version, typically corresponding to VERSION_ID in os-release | 33 | | name | The source package name | coreutils | -| version | The source package version | 4711.0815.fc13.arm32 | +| version | The source package version | 4711.0815.fc13 | +| architecture | The binary package architecture | arm32 | | osCpe | A CPE name for the OS, typically corresponding to CPE_NAME in os-release | cpe:/o:fedoraproject:fedora:33 | | debugInfoUrl | The debuginfod server url, if available | https://debuginfod.fedoraproject.org/ | From 98acae1f2135f8c2667c1acec8875ab4ad4aa4d0 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Tue, 26 Oct 2021 12:49:39 +0100 Subject: [PATCH 2/2] docs/COREDUMP_PACKAGE_METADATA: ELF section should be read-only and 4-bytes-aligned --- docs/COREDUMP_PACKAGE_METADATA.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/COREDUMP_PACKAGE_METADATA.md b/docs/COREDUMP_PACKAGE_METADATA.md index 1ff10d385d..fbbba1464c 100644 --- a/docs/COREDUMP_PACKAGE_METADATA.md +++ b/docs/COREDUMP_PACKAGE_METADATA.md @@ -33,9 +33,9 @@ This document will attempt to define a common metadata format specification, so multiple implementers might use it when building packages, or core file analyzers, and so on. -The metadata will be embedded in a single, new ELF header section, in a key-value JSON -format. Implementers working on parsing core files should not assume a specific list of -keys, but parse anything that is included in the section. +The metadata will be embedded in a single, new, 4-bytes-aligned, read-only ELF header section, +in a key-value JSON format. Implementers working on parsing core files should not assume a +specific list of keys, but parse anything that is included in the section. Implementers working on build tools should strive to use the same key names, for consistency. The most common will be listed here. When corresponding to the content of os-release, the values should match, again for consistency.