Index: glibc-2.3.3_pre20040420-r1.ebuild =================================================================== RCS file: /home/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.3.3_pre20040420-r1.ebuild,v retrieving revision 1.2 diff -u -b -B -w -p -r1.2 glibc-2.3.3_pre20040420-r1.ebuild --- glibc-2.3.3_pre20040420-r1.ebuild 17 May 2004 13:22:33 -0000 1.2 +++ glibc-2.3.3_pre20040420-r1.ebuild 24 May 2004 14:26:48 -0000 @@ -280,10 +280,16 @@ src_unpack() { # http://www.gentoo.org/proj/en/hardened/etdyn-ssp.xml if [ "${ARCH}" != "hppa" -a "${ARCH}" != "hppa64" ] then + local flags cd ${S} epatch ${FILESDIR}/2.3.3/${LOCAL_P}-propolice-guard-functions-v3.patch cp ${FILESDIR}/2.3.3/ssp.c ${S}/sysdeps/unix/sysv/linux || \ die "failed to copy ssp.c to ${S}/sysdeps/unix/sysv/linux/" + + has_ssp && flags="-fno-stack-protector -fno-stack-protector-all" + flags="${flags} -D__LIBSSP__ -Wl,-soname,libssp.so.${MY_PV}" + $(gcc-getCC) ${flags} -shared -fPIC -o ${S}/libssp.so.${MY_PV} ${FILESDIR}/2.3.3/ssp.c + # gcc 3.4 nukes ssp without this patch if [ "`gcc-major-version`" -ge "3" -a "`gcc-minor-version`" -ge "4" ] then @@ -648,6 +654,12 @@ EOF # Some things want this, notably ash. dosym /usr/lib/libbsd-compat.a /usr/lib/libbsd.a + + if [ -e "${S}/libssp.so.${MY_PV}" ] + then + cp ${S}/libssp.so.${MY_PV} ${D}/usr/lib/ + dosym /usr/lib/libssp.so.${MY_PV} /usr/lib/libssp.so + fi } pkg_postinst() { Index: files/2.3.3/ssp.c =================================================================== RCS file: /home/cvsroot/gentoo-x86/sys-libs/glibc/files/2.3.3/ssp.c,v retrieving revision 1.1 diff -u -b -B -w -p -r1.1 ssp.c --- files/2.3.3/ssp.c 14 May 2004 22:06:41 -0000 1.1 +++ files/2.3.3/ssp.c 24 May 2004 14:26:48 -0000 @@ -46,6 +46,10 @@ unsigned long __guard = 0UL; +#ifdef __LIBSSP__ +static void __guard_setup (void) __attribute__ ((constructor)); +static +#endif void __guard_setup (void) { @@ -103,7 +107,11 @@ __guard_setup (void) } void -__stack_smash_handler (char func[], int damaged) +__stack_smash_handler (char func[], int damaged +#ifdef __LIBSSP__ +ATTRIBUTE_UNUSED +#endif +) { struct sockaddr_un sock; /* AF_UNIX address of local logger */ struct sigaction sa;