Page MenuHomeFreeBSD

Add a WITH_BIND_NOW build knob
ClosedPublic

Authored by emaste on Nov 5 2018, 2:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 4 2024, 8:11 AM
Unknown Object (File)
Feb 23 2024, 2:39 PM
Unknown Object (File)
Feb 23 2024, 2:38 PM
Unknown Object (File)
Feb 23 2024, 2:37 PM
Unknown Object (File)
Feb 23 2024, 2:16 PM
Unknown Object (File)
Jan 4 2024, 2:31 PM
Unknown Object (File)
Jan 2 2024, 7:58 PM
Unknown Object (File)
Dec 20 2023, 3:15 AM
Subscribers

Details

Summary

The linker's -z now flag sets the DF_BIND_NOW flag, which signals to the runtime loader that all relocation processing should be performed at process startup rather than on demand. In combination with lld's default of enabling relro this causes the GOT to be made read-only when the process starts, preventing GOT overwrite attacks.

Diff Detail

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

Event Timeline

I had originally suggested to Shawn that he extract a patch (https://github.com/HardenedBSD/hardenedBSD/issues/356), but looked at the diffs and realized the changes are both trivial and going to conflict with HardenedBSD anyway (which has MK_RETPOLINE) arranged slightly differently.

There's a lot of commonality between bsd.prog.mk and bsd.lib.mk that could be factored out as a subsequent change.

Also note that our readelf does not display the DF_BIND_NOW flag -- see PR232983.

This revision is now accepted and ready to land.Nov 5 2018, 5:34 PM
This revision was automatically updated to reflect the committed changes.