Two fixes in one:

- our gcc should not bring libssp, because glibc provides __stack_chk_fail
  already. libssp is only for some non-glibc systems.
  The gcc configure script was not finding the header files of our glibc, so
  it assumed it did not provide __stack_chk_fail. I wrote code in the builder
  that patches the gcc/configure script properly for that.

  As a consequence, the glibc does not need anymore the "nscd-ssp-linking"
  patch, and we have a saner gcc (without libssp when using -fstack-protector)
- Instead of disabling the sse42 strstr() implementation in glibc due to the
  bug http://sourceware.org/bugzilla/show_bug.cgi?id=12123, I provide a better
  patch written after more reserach (that I submitted upstream already, and
  it's pending review).


svn path=/nixpkgs/branches/stdenv-updates/; revision=24493
This commit is contained in:
Lluís Batlle i Rossell 2010-10-26 18:56:02 +00:00
parent b9da5de4da
commit 2b34bdd2ba
5 changed files with 26 additions and 45 deletions

View File

@ -159,6 +159,14 @@ preConfigure() {
rm -Rf zlib
fi
# Patch the configure script so it finds glibc headers
# It's important for example in order not to get libssp built, because it's
# functionality is in glibc already.
glibc_headers="$(cat $NIX_GCC/nix-support/orig-libc)/include"
sed -i \
-e s,glibc_header_dir=/usr/include,glibc_header_dir=$glibc_headers, \
gcc/configure
if test -n "$crossMingw" -a -n "$crossStageStatic"; then
mkdir -p ../mingw
# --with-build-sysroot expects that:

View File

@ -75,22 +75,10 @@ stdenv.mkDerivation ({
/* Allow nixos and nix handle the locale-archive. */
./nix-locale-archive.patch
/* A fix for a glibc nscd linking bug, reported upstream already.*/
/* Currently this fix works only for i686; as it only affects
the building of glibc from a final nixpkgs stdenv, we don't care much
on whether it works or not. The patch does not affect building
from the bootstrap-tools gcc because it does not have libssp at all.
TODO: Link ssp to nscd dynamically, and set the proper rpath to
nscd, although linking dynamically will make this libc
dynamically linked with gcc's libssp, and gcc's libssp is dynamically
linked with stdenv.glibc's libc. This does not look very correct.
*/
./nscd-ssp-linking.patch
/* Patch already sent upstream against a segafult on libpthread load */
./libpthread_init.patch
/* Workaround for a glibc bug reported upstraem already */
./disable-strstr-sse42.patch
/* Fix for a vulnerability */
/* Fix for a vulnerability, taken from upstream */
./audit_suid.patch
];

View File

@ -1,14 +0,0 @@
Workaround for http://sources.redhat.com/bugzilla/show_bug.cgi?id=12123
diff --git a/sysdeps/i386/i686/multiarch/strstr-c.c b/sysdeps/i386/i686/multiarch/strstr-c.c
index efa9f78..cd34a88 100644
--- a/sysdeps/i386/i686/multiarch/strstr-c.c
+++ b/sysdeps/i386/i686/multiarch/strstr-c.c
@@ -10,4 +10,6 @@
extern char *__strstr_sse42 (const char *, const char *) attribute_hidden;
extern __typeof (__strstr_ia32) __strstr_ia32 attribute_hidden;
-libc_ifunc (strstr, HAS_SSE4_2 ? __strstr_sse42 : __strstr_ia32);
+// Disabled any sse42, due to a bug:
+// http://sources.redhat.com/bugzilla/show_bug.cgi?id=12123
+libc_ifunc (strstr, __strstr_ia32);

View File

@ -0,0 +1,15 @@
http://sourceware.org/bugzilla/show_bug.cgi?id=12123
diff --git a/nptl/sysdeps/i386/Makefile b/nptl/sysdeps/i386/Makefile
index 2f0d88f..3d9d223 100644
--- a/nptl/sysdeps/i386/Makefile
+++ b/nptl/sysdeps/i386/Makefile
@@ -21,6 +21,8 @@ gen-as-const-headers += tcb-offsets.sym
endif
ifeq ($(subdir),nptl)
+CFLAGS-nptl-init.c += -mpreferred-stack-boundary=4
+CFLAGS-pt-initfini.c += -mpreferred-stack-boundary=4
CFLAGS-pthread_create.c += -mpreferred-stack-boundary=4
CFLAGS-tst-align.c += -mpreferred-stack-boundary=4
CFLAGS-tst-align2.c += -mpreferred-stack-boundary=4

View File

@ -1,16 +0,0 @@
http://sources.redhat.com/bugzilla/show_bug.cgi?id=12125
diff --git a/nscd/Makefile b/nscd/Makefile
index 93874e5..63f7144 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -90,6 +90,9 @@ CFLAGS-nscd_initgroups.c = -fexceptions
nscd-cflags = -DIS_IN_nscd=1 -D_FORTIFY_SOURCE=2
ifeq (yesyes,$(have-fpie)$(build-shared))
nscd-cflags += $(pie-ccflag)
+ifeq (yes,$(have-ssp))
+link-extra-libs += -Wl,-Bstatic -lssp -Wl,-Bdynamic
+endif
endif
ifeq (yes,$(have-ssp))
nscd-cflags += -fstack-protector