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)
Dec 26 2023, 5:05 PM
Unknown Object (File)
Dec 20 2023, 6:25 AM
Unknown Object (File)
Dec 9 2023, 6:22 PM
Unknown Object (File)
Dec 9 2023, 12:13 PM
Unknown Object (File)
Dec 9 2023, 11:43 AM
Unknown Object (File)
Nov 19 2023, 3:36 AM
Unknown Object (File)
Nov 19 2023, 3:04 AM
Unknown Object (File)
Nov 17 2023, 1:11 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.