Summer Coding 2010 ideas - Universal Build-ID
The main page for this idea is Summer Coding 2010 ideas - Universal Build-ID.
Summary of idea: Extend the Build-ID support to make it more universally usable.
Notes: This is not a completely worked out idea yet. A proposal should pick one or more scenarios and create a concrete implementation plan.
Since Fedora Core 8 there is support for build-ids. https://fedoraproject.org/wiki/Releases/FeatureBuildId
Build-IDs are unique identifiers of "builds". A build is an executable, a shared library, the kernel, a module, etc. You can also find the build-id in a running process, a core file or a separate debuginfo file.
A simple way to get the build-id(s) is through eu-unstrip (part of elfutils).
build-id from an executable, shared library or separate debuginfo file:
$ eu-unstrip -n -e <exec|.sharedlib|.debug>
build-ids of an executable and all shared libraries from a core file:
$ eu-unstrip -n --core <corefile>
build-ids of an executable and all shared libraries of a running process:
$ eu-unstrip -n --pid <pid>
build-id of the running kernel and all loaded modules:
$ eu-unstrip -n -k
The convention that is currently being used by Fedora (and which has been adopted by for example GDB to find files) is to include a link in the debuginfo file that points to the elf file and the debuginfo file under /usr/lib/debug/.build-id/XX/YYYY (where XX are the first two hex-digits of the build id and YYYY are all the others):
/usr/lib/debug/.build-id/c7/a002ba1eb1dbc7c609d2e5fb9a57f10861dbdd -> ../../../../../bin/bash /usr/lib/debug/.build-id/c7/a002ba1eb1dbc7c609d2e5fb9a57f10861dbdd.debug -> ../../bin/bash.debug
This makes it extremely easy to find the executable or shared library and the corresponding debuginfo just given the build-id. If they are installed on your system.
Since these are files included in the rpm package, it also makes it easy to find the package that provided the executable/library, that corresponds to the build id (gdb and systemtap will suggest the right debuginfo package to install based on the build-id they found for the program you wanted to introspect). You can ask yum to install it, or use repoquery to figure out the details of the package and binary involved.
But this is only for the latest current/up-to-date installed repository. There is no support for historical information, local builds, cross-distro, etc. Extending the usefulness of having build-ids is what this idea is about.
How do we scale this idea up/down?
The target is that when you get a build-id for something (anything really, an old executable, a core file once made but never fully investigated, some currently running process that needs to be introspected but that has had its libraries upgraded on disk already) and mapping it to the original developer, "creator", package, distributor, executable, sources, debuginfo files, etc.
- Up in fedora, what about getting "historical" mappings?
- Up towards other distributions (packagekit?)
- Up towards a general build-id mapping universe (build-id.org).
- Generic registration, querying and mapping of build-ids
- Down towards to local database for lone developer.
- Or an local shop that builds upon an existing distro, but also has (internal) apps in their organization.
- To totally disorganized "installs" where people move around executables all the time (inotify/updatedb).
- How do we "proxy" this information between the different layers, so tools can have one query mechanism that works for any build-id that they happen to come across.
- Tie-in to packagekit, abrt, debuginfo-fs?