[systemd-devel] coredumpctl: matching by e.g. env var?

Luca Boccassi luca.boccassi at gmail.com
Wed Mar 15 12:18:15 UTC 2023


On Wed, 15 Mar 2023 at 10:43, Stephan Bergmann <sbergman at redhat.com> wrote:
>
> On 15/03/2023 11:29, Luca Boccassi wrote:
> > Use the elf metadata spec: https://systemd.io/ELF_PACKAGE_METADATA/
> >
> > I need to update that, as these days it's no longer necessary to use a
> > custom linker script, but with binutils 2.39 (or mold 1.3.0 or lld
> > 15.0) it's as easy as passing as a linker flag:
> > --package-metadata='{"foo":"bar"}'
> > and it will be appended in the right location in the binary.
> > systemd-coredump will parse that, and attach it as-is as a
> > COREDUMP_PACKAGE_JSON= field in the journal.
> > If the json contains fields named 'name' and/or 'version' they will
> > also be appended independently as COREDUMP_PACKAGE_NAME= and
> > COREDUMP_PACKAGE_VERSION=
>
> But as I said "many different tests use the same test runner
> executable".  So I'm not sure how adding ELF metadata to some binary
> would help me in any way?  For example, two different tests recipes A
> and B each run python programs that each spawn a native soffice.bin
> process, where those soffice.bin processes don't include any .so that
> are specific to each test.  If test A fails, its recipe should dump
> backtraces for all core files caused by test A, but not for any core
> files caused by test B.

The hard part is adding the note correctly, with the right size,
alignment, flags, etc. You can use the linker to add a placeholder
value, eg --package-metadata='{"name":"LO-testcase-xxxxxxxx"}' and
then simply edit in place before each test, as long as you keep the
length identical, it should be trivial and quick to do.


More information about the systemd-devel mailing list