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)
Tue, Dec 24, 12:04 PM
Unknown Object (File)
Fri, Dec 20, 5:25 PM
Unknown Object (File)
Fri, Dec 20, 5:22 PM
Unknown Object (File)
Sun, Dec 8, 9:23 PM
Unknown Object (File)
Nov 22 2024, 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
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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.