|
|
147e83 |
This patch is based on the following upstream commit:
|
|
|
147e83 |
|
|
|
147e83 |
commit 2d6ab5df3b675e96ee587ae6a8c2ce004c6b1ba9
|
|
|
147e83 |
Author: Florian Weimer <fweimer@redhat.com>
|
|
|
147e83 |
Date: Thu Mar 2 14:44:28 2017 +0100
|
|
|
147e83 |
|
|
|
147e83 |
Document and fix --enable-bind-now [BZ #21015]
|
|
|
147e83 |
|
|
|
147e83 |
diff --git a/INSTALL b/INSTALL
|
|
|
147e83 |
index 82b29f5d8746f929..230be71b9d0821c2 100644
|
|
|
147e83 |
--- a/INSTALL
|
|
|
147e83 |
+++ b/INSTALL
|
|
|
147e83 |
@@ -143,6 +143,12 @@ will be used, and CFLAGS sets optimization options for the compiler.
|
|
|
147e83 |
`--enable-lock-elision=yes'
|
|
|
147e83 |
Enable lock elision for pthread mutexes by default.
|
|
|
147e83 |
|
|
|
147e83 |
+'--enable-bind-now'
|
|
|
147e83 |
+ Disable lazy binding for installed shared objects. This provides
|
|
|
147e83 |
+ additional security hardening because it enables full RELRO and a
|
|
|
147e83 |
+ read-only global offset table (GOT), at the cost of slightly
|
|
|
147e83 |
+ increased program load times.
|
|
|
147e83 |
+
|
|
|
147e83 |
`--disable-werror'
|
|
|
147e83 |
By default, the GNU C Library is built with `-Werror'. If you wish
|
|
|
147e83 |
to build without this option (for example, if building with a newer
|
|
|
147e83 |
diff --git a/Makeconfig b/Makeconfig
|
|
|
147e83 |
index f8313c9774d47522..1ad9b6f0d494c027 100644
|
|
|
147e83 |
--- a/Makeconfig
|
|
|
147e83 |
+++ b/Makeconfig
|
|
|
147e83 |
@@ -384,6 +384,13 @@ LDFLAGS.so += $(hashstyle-LDFLAGS)
|
|
|
147e83 |
LDFLAGS-rtld += $(hashstyle-LDFLAGS)
|
|
|
147e83 |
endif
|
|
|
147e83 |
|
|
|
147e83 |
+# If lazy relocations are disabled, add the -z now flag. Use
|
|
|
147e83 |
+# LDFLAGS-lib.so instead of LDFLAGS.so, to avoid adding the flag to
|
|
|
147e83 |
+# test modules.
|
|
|
147e83 |
+ifeq ($(bind-now),yes)
|
|
|
147e83 |
+LDFLAGS-lib.so += -Wl,-z,now
|
|
|
147e83 |
+endif
|
|
|
147e83 |
+
|
|
|
147e83 |
# Additional libraries to link into every test.
|
|
|
147e83 |
link-extra-libs-tests = $(libsupport)
|
|
|
147e83 |
|
|
|
147e83 |
diff --git a/Makerules b/Makerules
|
|
|
147e83 |
index 9bd7d603fc28a4de..50fe7e48187f0e68 100644
|
|
|
147e83 |
--- a/Makerules
|
|
|
147e83 |
+++ b/Makerules
|
|
|
147e83 |
@@ -477,7 +477,7 @@ $(LINK.o) -shared $(static-libgcc) -Wl,-O1 $(sysdep-LDFLAGS) \
|
|
|
147e83 |
$(extra-B-$(@F:lib%.so=%).so) -B$(csu-objpfx) \
|
|
|
147e83 |
$(extra-B-$(@F:lib%.so=%).so) $(load-map-file) \
|
|
|
147e83 |
-Wl,-soname=lib$(libprefix)$(@F:lib%.so=%).so$($(@F)-version) \
|
|
|
147e83 |
- $(LDFLAGS.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
|
|
|
147e83 |
+ $(LDFLAGS.so) $(LDFLAGS-lib.so) $(LDFLAGS-$(@F:lib%.so=%).so) \
|
|
|
147e83 |
-L$(subst :, -L,$(rpath-link)) -Wl,-rpath-link=$(rpath-link)
|
|
|
147e83 |
endef
|
|
|
147e83 |
|
|
|
147e83 |
@@ -938,7 +938,8 @@ $(common-objpfx)format.lds: $(..)scripts/output-format.sed \
|
|
|
147e83 |
ifneq (unknown,$(output-format))
|
|
|
147e83 |
echo > $@.new 'OUTPUT_FORMAT($(output-format))'
|
|
|
147e83 |
else
|
|
|
147e83 |
- $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
|
|
|
147e83 |
+ $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) \
|
|
|
147e83 |
+ $(LDFLAGS.so) $(LDFLAGS-lib.so) \
|
|
|
147e83 |
-x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
|
|
|
147e83 |
| sed -n -f $< > $@.new
|
|
|
147e83 |
test -s $@.new
|
|
|
147e83 |
diff --git a/iconvdata/Makefile b/iconvdata/Makefile
|
|
|
147e83 |
index 7930dcd49d77c818..ddb2dc6a3c6500c8 100644
|
|
|
147e83 |
--- a/iconvdata/Makefile
|
|
|
147e83 |
+++ b/iconvdata/Makefile
|
|
|
147e83 |
@@ -65,6 +65,10 @@ modules.so := $(addsuffix .so, $(modules))
|
|
|
147e83 |
|
|
|
147e83 |
include ../Makeconfig
|
|
|
147e83 |
|
|
|
147e83 |
+ifeq ($(bind-now),yes)
|
|
|
147e83 |
+LDFLAGS.so += -Wl,-z,now
|
|
|
147e83 |
+endif
|
|
|
147e83 |
+
|
|
|
147e83 |
ifeq (yes,$(build-shared))
|
|
|
147e83 |
tests = bug-iconv1 bug-iconv2 tst-loading tst-e2big tst-iconv4 bug-iconv4 \
|
|
|
147e83 |
tst-iconv6 bug-iconv5 bug-iconv6 tst-iconv7 bug-iconv8 bug-iconv9 \
|
|
|
147e83 |
diff --git a/manual/install.texi b/manual/install.texi
|
|
|
147e83 |
index 3799cee621ddc4f9..47d832cc59bc695e 100644
|
|
|
147e83 |
--- a/manual/install.texi
|
|
|
147e83 |
+++ b/manual/install.texi
|
|
|
147e83 |
@@ -160,6 +160,12 @@ so that they can be invoked directly.
|
|
|
147e83 |
@item --enable-lock-elision=yes
|
|
|
147e83 |
Enable lock elision for pthread mutexes by default.
|
|
|
147e83 |
|
|
|
147e83 |
+@item --enable-bind-now
|
|
|
147e83 |
+Disable lazy binding for installed shared objects. This provides
|
|
|
147e83 |
+additional security hardening because it enables full RELRO and a
|
|
|
147e83 |
+read-only global offset table (GOT), at the cost of slightly increased
|
|
|
147e83 |
+program load times.
|
|
|
147e83 |
+
|
|
|
147e83 |
@pindex pt_chown
|
|
|
147e83 |
@findex grantpt
|
|
|
147e83 |
@item --enable-pt_chown
|