Writing core files to contain buildids

Paul Smith paul@mad-scientist.net
Tue Oct 27 20:20:51 GMT 2020


Thanks Mark,

On Tue, 2020-10-27 at 15:39 +0100, Mark Wielaard wrote:
> The basic idea behind getting buildids into core files is that they
> (the GNU ELF notes) are at the start of the file in the first page
> that is dumped (together with the phdrs) in the core file so when
> core file consumers can walk the program headers and find the buildid
> note (almost immediately following those headers).

Something is missing; if I check the binary I see a build ID in it.  I
can control whether the userspace coredumper or the kernel coredumper
is used via an environment variable: the kernel-generated core contains
a full set of build ID values including vdso.so, the binary, and all
normal .so's.

But when using the userspace coredumper I get a completely valid
coredump that GDB is happy with, for example, but there is only the
vdso.so build ID present: I don't see any build IDs from the binary or
shared libraries.

I guess another possibility is that they are there but eu-unstrip
--core can't find them?

The userspace coredumper uses the output of /proc/self/maps and
/proc/self/smaps to determine what memory to dump; the code is a bit
hairy but I will investigate what's going on.

The parsing of the maps starts here (I don't really expect anyone to
read this but if you're curious):

https://github.com/madscientist/google-coredumper/blob/1b64fbc282ba08654853f34c2bda00ffe5e26855/src/elfcore.c#L760

and the write-out starts here:

https://github.com/madscientist/google-coredumper/blob/1b64fbc282ba08654853f34c2bda00ffe5e26855/src/elfcore.c#L1019

> A few more technical details can be found at:
> https://fedoraproject.org/wiki/Releases/FeatureBuildId#Include_build_IDs_in_core_dumps

Thanks I did see that but I will read it harder.



More information about the Elfutils-devel mailing list