aboutsummaryrefslogtreecommitdiff
path: root/tools/build/options/WITH_BIND_NOW
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2018-11-06 15:52:49 +0000
committerEd Maste <emaste@FreeBSD.org>2018-11-06 15:52:49 +0000
commitbf81eb3ca9758d6a45f5a92c0689fcad455827cd (patch)
treec67a90fc01377b4f0d92e950495ae54b5d749d90 /tools/build/options/WITH_BIND_NOW
parent02bf7e5e40ddaa79a2089ef221350f35f033c421 (diff)
Add a WITH_BIND_NOW build knob
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 straightforward GOT overwrite attacks. Shawn Webb discovered a failure on HardenedBSD with BIND_NOW and ifunc use, which resulted in my rtld fix in r340137. Add a BIND_NOW knob as it is trivial to do so and is a useful ELF hardening feature. This change is equivalent to HardenedBSD's but not identical as there are other diffs/conflicts nearby. Note that our ELF Tool Chain readelf does not currently decode the DF_BIND_NOW flag - see PR232983. Reviewed by: brooks MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D17846
Notes
Notes: svn path=/head/; revision=340186
Diffstat (limited to 'tools/build/options/WITH_BIND_NOW')
-rw-r--r--tools/build/options/WITH_BIND_NOW5
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/build/options/WITH_BIND_NOW b/tools/build/options/WITH_BIND_NOW
new file mode 100644
index 000000000000..02e4c37352b4
--- /dev/null
+++ b/tools/build/options/WITH_BIND_NOW
@@ -0,0 +1,5 @@
+.\" $FreeBSD$
+Build all binaries with the
+.Dv DF_BIND_NOW
+flag set to indicate that the run-time loader should perform all relocation
+processing at process startup rather than on demand.