olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh1406732-2.patch

00db10
This patch is based on the following upstream commit:
00db10
00db10
commit 94a4e9e4f401ffe829a992820439977ead0a0ce7
00db10
Author: Florian Weimer <fweimer@redhat.com>
00db10
Date:   Thu Apr 25 10:41:43 2019 +0200
00db10
00db10
    Extend BIND_NOW to installed programs with --enable-bind-now
00db10
    
00db10
    Commit 2d6ab5df3b675e96ee587ae6a8c2ce004c6b1ba9 ("Document and fix
00db10
    --enable-bind-now [BZ #21015]") extended BIND_NOW to all installed
00db10
    shared objects.  This change also covers installed programs.
00db10
    
00db10
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
00db10
00db10
diff --git a/INSTALL b/INSTALL
00db10
index 230be71b9d0821c2..277ea46d9c25a9ae 100644
00db10
--- a/INSTALL
00db10
+++ b/INSTALL
00db10
@@ -144,10 +144,10 @@ will be used, and CFLAGS sets optimization options for the compiler.
00db10
      Enable lock elision for pthread mutexes by default.
00db10
 
00db10
 '--enable-bind-now'
00db10
-     Disable lazy binding for installed shared objects.  This provides
00db10
-     additional security hardening because it enables full RELRO and a
00db10
-     read-only global offset table (GOT), at the cost of slightly
00db10
-     increased program load times.
00db10
+     Disable lazy binding for installed shared objects and programs.
00db10
+     This provides additional security hardening because it enables full
00db10
+     RELRO and a read-only global offset table (GOT), at the cost of
00db10
+     slightly increased program load times.
00db10
 
00db10
 `--disable-werror'
00db10
      By default, the GNU C Library is built with `-Werror'.  If you wish
00db10
diff --git a/Makeconfig b/Makeconfig
00db10
index 1ad9b6f0d494c027..bc13b39c2ea5708a 100644
00db10
--- a/Makeconfig
00db10
+++ b/Makeconfig
00db10
@@ -389,6 +389,8 @@ endif
00db10
 # test modules.
00db10
 ifeq ($(bind-now),yes)
00db10
 LDFLAGS-lib.so += -Wl,-z,now
00db10
+# Extra flags for dynamically linked non-test main programs.
00db10
+link-extra-flags += -Wl,-z,now
00db10
 endif
00db10
 
00db10
 # Additional libraries to link into every test.
00db10
@@ -405,7 +407,8 @@ ifndef +link-pie
00db10
 						    S$(start-installed-name))\
00db10
 			  $(+preinit) $(link-extra-libs) \
00db10
 			  $(common-objpfx)libc% $(+postinit),$^) \
00db10
-	     $(link-extra-libs) $(link-libc) $(+postctorS) $(+postinit)
00db10
+	     $(link-extra-libs) $(link-extra-flags) $(link-libc) \
00db10
+	     $(+postctorS) $(+postinit)
00db10
 endif
00db10
 # Command for statically linking programs with the C library.
00db10
 ifndef +link-static
00db10
@@ -419,8 +422,8 @@ ifndef +link-static
00db10
 			   $(common-objpfx)libc% $(+postinit),$^) \
00db10
 	      $(link-extra-libs-static)
00db10
 +link-static-after-libc = $(+postctorT) $(+postinit)
00db10
-+link-static = $(+link-static-before-libc) $(link-libc-static) \
00db10
-	       $(+link-static-after-libc)
00db10
++link-static = $(+link-static-before-libc) $(link-extra-flags) \
00db10
+	       $(link-libc-static) $(+link-static-after-libc)
00db10
 +link-static-tests = $(+link-static-before-libc) $(link-libc-static-tests) \
00db10
 		     $(+link-static-after-libc)
00db10
 endif
00db10
@@ -438,7 +441,8 @@ ifeq (yes,$(build-shared))
00db10
 			   $(common-objpfx)libc% $(+postinit),$^) \
00db10
 	      $(link-extra-libs)
00db10
 +link-after-libc = $(+postctor) $(+postinit)
00db10
-+link = $(+link-before-libc) $(link-libc) $(+link-after-libc)
00db10
++link = $(+link-before-libc) $(link-extra-flags) $(link-libc) \
00db10
+	$(+link-after-libc)
00db10
 +link-tests = $(+link-before-libc) $(link-libc-tests) $(+link-after-libc)
00db10
 else
00db10
 +link = $(+link-static)
00db10
diff --git a/manual/install.texi b/manual/install.texi
00db10
index 47d832cc59bc695e..5cacd974ce093ce9 100644
00db10
--- a/manual/install.texi
00db10
+++ b/manual/install.texi
00db10
@@ -161,10 +161,10 @@ so that they can be invoked directly.
00db10
 Enable lock elision for pthread mutexes by default.
00db10
 
00db10
 @item --enable-bind-now
00db10
-Disable lazy binding for installed shared objects.  This provides
00db10
-additional security hardening because it enables full RELRO and a
00db10
-read-only global offset table (GOT), at the cost of slightly increased
00db10
-program load times.
00db10
+Disable lazy binding for installed shared objects and programs.  This
00db10
+provides additional security hardening because it enables full RELRO
00db10
+and a read-only global offset table (GOT), at the cost of slightly
00db10
+increased program load times.
00db10
 
00db10
 @pindex pt_chown
00db10
 @findex grantpt