Page MenuHomeFreeBSD

Add build-id to kernel and module link commandlines
ClosedPublic

Authored by emaste on Jun 23 2017, 1:44 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Dec 8, 9:23 PM
Unknown Object (File)
Fri, Nov 22, 4:42 AM
Unknown Object (File)
Nov 10 2024, 5:17 PM
Unknown Object (File)
Nov 5 2024, 5:51 AM
Unknown Object (File)
Oct 28 2024, 12:27 AM
Unknown Object (File)
Sep 30 2024, 1:47 PM
Unknown Object (File)
Sep 27 2024, 7:14 AM
Unknown Object (File)
Sep 24 2024, 12:50 PM
Subscribers

Details

Summary

Build-ID is a identifier generated at link time to uniquely identify ELF binaries. It allows efficient confirmation that an executable or shared library and the corresponding standalone debuginfo match. (Otherwise a checksum of the debuginfo file must be calculated.)

Build-ID support was added to GNU ld shortly after the 2.17.50 release in the FreeBSD base system, so was not previously available to us. As we migrate to lld or to ports binutils we can start making use of it.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

LGTM. The only thing I'm hesitant about is using SHA-1 while that is very much deprecated, but I guess it will have to do... :)

This revision is now accepted and ready to land.Jun 23 2017, 2:36 PM

The only thing I'm hesitant about is using SHA-1 while that is very much deprecated

I'm not aware of Build-ID use cases that are subject to intentional collision attempts; sha1 should be more than adequate against accidental collisions. That said, I would prefer to avoid it on general principle, but as of now it's the best available option.

lld and gold support md5, sha1, tree, uuid, and an explicit hex value.

This revision was automatically updated to reflect the committed changes.

For the record

More information is here:
https://fedoraproject.org/wiki/Releases/FeatureBuildId

( ... and since there is no good place to mention this)
Looking at the date when the initial patch was submitted, there maybe a patch for our older binutils under an acceptable license:
https://sourceware.org/ml/binutils/2007-07/msg00012.html
(looking at the thread, the patch was committed with a followup fix):
https://sourceware.org/ml/binutils/2007-07/msg00204.html

No idea if we want to play with that in the dying binutils though.
There may be issues:
https://bugzilla.redhat.com/show_bug.cgi?id=338221

I emailed Roland McGrath privately about the build-id patches, which were developed while ld.bfd was GPLv2 but committed after it switched to GPLv3. From that discussion it seemed feasible for us to produce a GPLv2 ld with build-id. The fact that a number of bugs & fixes are post-GPLv3 and our plan to deprecate ancient ld.bfd 2.17.50 convinced me it's not worth pursuing.