diff options
author | Ned Ludd <solar@gentoo.org> | 2004-08-07 23:30:19 +0000 |
---|---|---|
committer | Ned Ludd <solar@gentoo.org> | 2004-08-07 23:30:19 +0000 |
commit | e06ccd629d8ecc9bb16a0a068a9d5a15db451dc8 (patch) | |
tree | 868cd882e66fabcb2053ac5ef0f63359e6036f09 /dev-libs/dietlibc | |
parent | src_install() { (diff) | |
download | historical-e06ccd629d8ecc9bb16a0a068a9d5a15db451dc8.tar.gz historical-e06ccd629d8ecc9bb16a0a068a9d5a15db451dc8.tar.bz2 historical-e06ccd629d8ecc9bb16a0a068a9d5a15db451dc8.zip |
Made dietlibc propolice/ssp aware on arches sparc/sparc64/x86_64/i386. Also made feeble attempt to version bump to 0.27 but that failed something fierce
Diffstat (limited to 'dev-libs/dietlibc')
-rw-r--r-- | dev-libs/dietlibc/ChangeLog | 6 | ||||
-rw-r--r-- | dev-libs/dietlibc/Manifest | 24 | ||||
-rw-r--r-- | dev-libs/dietlibc/dietlibc-0.26-r1.ebuild | 70 | ||||
-rw-r--r-- | dev-libs/dietlibc/files/dietlibc-0.26-ssp.patch | 54 | ||||
-rw-r--r-- | dev-libs/dietlibc/files/digest-dietlibc-0.26-r1 | 1 | ||||
-rw-r--r-- | dev-libs/dietlibc/files/ssp.c | 166 |
6 files changed, 310 insertions, 11 deletions
diff --git a/dev-libs/dietlibc/ChangeLog b/dev-libs/dietlibc/ChangeLog index ff88573c8c8e..a2541b3f62ef 100644 --- a/dev-libs/dietlibc/ChangeLog +++ b/dev-libs/dietlibc/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for dev-libs/dietlibc # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/dietlibc/ChangeLog,v 1.33 2004/07/20 06:21:36 eradicator Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-libs/dietlibc/ChangeLog,v 1.34 2004/08/07 23:30:19 solar Exp $ + + 07 Aug 2004; <solar@gentoo.org> : + Made dietlibc propolice/ssp aware on arches sparc/sparc64/x86_64/i386. Also + made feeble attempt to version bump to 0.27 but that failed something fierce 19 Jul 2004; Jeremy Huddleston <eradicator@gentoo.org> dietlibc-0.23.ebuild: || die for sparc's make in src_compile(). diff --git a/dev-libs/dietlibc/Manifest b/dev-libs/dietlibc/Manifest index 594e2a790e93..b84611bc6170 100644 --- a/dev-libs/dietlibc/Manifest +++ b/dev-libs/dietlibc/Manifest @@ -1,20 +1,24 @@ -MD5 a38b3e68699be56cfbec1ca7d7be8431 ChangeLog 4690 -MD5 38e3d6d5a07b52b28a667d850d3cfe1c dietlibc-0.22-r2.ebuild 1667 +MD5 fe7b2b9d20c36184dfdd9b3ef2c9158d dietlibc-0.26-r1.ebuild 1903 MD5 5100407ec03ec6e53d0b8507ed73a18d dietlibc-0.23.ebuild 1766 -MD5 3094bbd430e85329034c7a7cc26e49e7 dietlibc-0.24.ebuild 1527 MD5 721c2cabf848750556eb82dc89bb9c0a dietlibc-0.25.ebuild 1571 +MD5 38e3d6d5a07b52b28a667d850d3cfe1c dietlibc-0.22-r2.ebuild 1667 +MD5 3094bbd430e85329034c7a7cc26e49e7 dietlibc-0.24.ebuild 1527 +MD5 e2a4edde29ddd195df911c0acc39cad3 ChangeLog 4879 MD5 6d7429e88eda74e2e5a1d89dcda32c33 metadata.xml 400 MD5 8de66752df8ab2859aa5fa2a544a09b7 dietlibc-0.26.ebuild 1573 -MD5 e33c0d8f3c56f85d1caa98118824fceb files/0.22-dirent-prototype.patch 563 -MD5 2d0f660abd258d75417ef8abd8ab5eb7 files/0.23-dirent-prototype.patch 668 -MD5 2d0f660abd258d75417ef8abd8ab5eb7 files/0.24-dirent-prototype.patch 668 -MD5 02d59156de2a7a0f914dc5769e26cdcf files/0.25-gcc34.patch 3454 -MD5 67b93dd4033c0e66d42b6bade33c73fc files/dietlibc-0.22_xdr_security_fix.patch 5566 -MD5 4713f8664ff94fb53c7696d9204406ed files/dietlibc-0.23-hppa.patch 3954 MD5 8c25662fd30d966f24ec20ef491075a6 files/dietlibc-sparc64-makefile.patch 499 +MD5 4713f8664ff94fb53c7696d9204406ed files/dietlibc-0.23-hppa.patch 3954 +MD5 8dcca4f3b79565a3c205dbb0ef2d20bd files/ssp.c 4038 MD5 2644f8611fcb7a147ec9ef76eaf5992a files/digest-dietlibc-0.22-r2 66 +MD5 4c8bea996353605b5d0b6184d8836ffe files/digest-dietlibc-0.26-r1 66 +MD5 67b93dd4033c0e66d42b6bade33c73fc files/dietlibc-0.22_xdr_security_fix.patch 5566 +MD5 5068166c23e6910d2d2d6121ded46382 files/dietlibc-0.26-ssp.patch 1596 +MD5 9247251c0adc5ce1b626d7092ae0c903 files/gcc-33.patch 482 +MD5 2d0f660abd258d75417ef8abd8ab5eb7 files/0.24-dirent-prototype.patch 668 +MD5 2d0f660abd258d75417ef8abd8ab5eb7 files/0.23-dirent-prototype.patch 668 +MD5 e33c0d8f3c56f85d1caa98118824fceb files/0.22-dirent-prototype.patch 563 MD5 b06d21ffc62c7a660a29351e55213a0b files/digest-dietlibc-0.23 66 MD5 11048a235efe4eefcfffc4ccffa60821 files/digest-dietlibc-0.24 66 MD5 a6911c79e510ea03173a809f5d7e6a40 files/digest-dietlibc-0.25 66 -MD5 9247251c0adc5ce1b626d7092ae0c903 files/gcc-33.patch 482 MD5 4c8bea996353605b5d0b6184d8836ffe files/digest-dietlibc-0.26 66 +MD5 02d59156de2a7a0f914dc5769e26cdcf files/0.25-gcc34.patch 3454 diff --git a/dev-libs/dietlibc/dietlibc-0.26-r1.ebuild b/dev-libs/dietlibc/dietlibc-0.26-r1.ebuild new file mode 100644 index 000000000000..8682d371c48c --- /dev/null +++ b/dev-libs/dietlibc/dietlibc-0.26-r1.ebuild @@ -0,0 +1,70 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/dietlibc/dietlibc-0.26-r1.ebuild,v 1.1 2004/08/07 23:30:19 solar Exp $ + +inherit eutils flag-o-matic fixheadtails gcc + +DESCRIPTION="A minimal libc" +HOMEPAGE="http://www.fefe.de/dietlibc/" +SRC_URI="mirror://kernel/linux/libs/${PN}/${P}.tar.bz2" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86 ~ppc ~sparc ~alpha ~arm ~hppa ~amd64" +IUSE="" + +DEPEND=">=sys-apps/sed-4" + +src_unpack() { + unpack ${A} + cd ${S} + + epatch "${FILESDIR}/0.24-dirent-prototype.patch" + [ $(gcc-major-version) -eq 3 ] \ + && epatch ${FILESDIR}/gcc-33.patch + +# && epatch ${FILESDIR}/${PV}-gcc34.patch + + # depending on glibc to provide guard symbols, does not work with -nostdlib building + filter-flags -fstack-protector -fstack-protector-all + + # Ok so let's make dietlibc ssp aware (Aug 7 2004) -solar + ebegin "Making dietlibc ssp aware" + cp ${FILESDIR}/ssp.c ${S}/lib/ || die "Failed to copy ssp.c into lib for compile" + eend $? + + # start with sparc/sparc64/x86_64/i386 for now. + epatch ${FILESDIR}/dietlibc-0.26-ssp.patch + append-flags -D__dietlibc__ + # end ssp block code + + # Fix for 45716 + replace-sparc64-flags + + sed -i \ + -e "s:^CFLAGS.*:CFLAGS = ${CFLAGS}:" \ + -e "s:^prefix.*:prefix=/usr/diet:" \ + -e "s:^#DESTDIR=.*:DESTDIR=${D}:" \ + Makefile \ + || die "sed Makefile failed" + + # New fix for sparc64 and dietlibc, fixes bug #45601 + [ "${PROFILE_ARCH}" = "sparc64" ] && \ + epatch ${FILESDIR}/dietlibc-sparc64-makefile.patch + + ht_fix_all +} + +src_compile() { + emake || die "emake failed" +} + +src_install() { + make install || die "make install failed" + + exeinto /usr/bin + newexe bin-$(uname -m | sed -e 's/i[4-9]86/i386/' -e 's/armv[3-6][lb]/arm/' -e 's/sparc64/sparc/')/diet-i diet || die "newexe failed" + + doman diet.1 + dodoc AUTHOR BUGS CAVEAT CHANGES README THANKS TODO PORTING +} diff --git a/dev-libs/dietlibc/files/dietlibc-0.26-ssp.patch b/dev-libs/dietlibc/files/dietlibc-0.26-ssp.patch new file mode 100644 index 000000000000..865f133a5b52 --- /dev/null +++ b/dev-libs/dietlibc/files/dietlibc-0.26-ssp.patch @@ -0,0 +1,54 @@ +diff -Nrup dietlibc-0.26.orig/i386/start.S dietlibc-0.26/i386/start.S +--- dietlibc-0.26.orig/i386/start.S 2003-04-17 09:55:39.000000000 -0400 ++++ dietlibc-0.26/i386/start.S 2004-08-07 18:50:52.000000000 -0400 +@@ -50,7 +50,9 @@ _start: + PUT_VAR %edi, __vsyscall, %edx + 1: + #endif +- ++#ifdef __dietlibc__ ++ call __guard_setup ++#endif + #ifdef WANT_DYNAMIC + call _dyn_start + #else +diff -Nrup dietlibc-0.26.orig/sparc/start.S dietlibc-0.26/sparc/start.S +--- dietlibc-0.26.orig/sparc/start.S 2003-08-22 08:16:23.000000000 -0400 ++++ dietlibc-0.26/sparc/start.S 2004-08-07 18:55:26.000000000 -0400 +@@ -29,6 +29,9 @@ _start: + be NULL. */ + + /* Let libc do the rest of the initialization, and call main. */ ++#ifdef __dietlibc__ ++ call __guard_setup ++#endif + #ifdef WANT_DYNAMIC + call dyn_start + #else +diff -Nrup dietlibc-0.26.orig/sparc64/start.S dietlibc-0.26/sparc64/start.S +--- dietlibc-0.26.orig/sparc64/start.S 2003-08-22 08:16:23.000000000 -0400 ++++ dietlibc-0.26/sparc64/start.S 2004-08-07 18:55:36.000000000 -0400 +@@ -29,6 +29,9 @@ _start: + be NULL. */ + + /* Let libc do the rest of the initialization, and call main. */ ++#ifdef __dietlibc__ ++ call __guard_setup ++#endif + #ifdef WANT_DYNAMIC + call dyn_start + #else +diff -Nrup dietlibc-0.26.orig/x86_64/start.S dietlibc-0.26/x86_64/start.S +--- dietlibc-0.26.orig/x86_64/start.S 2003-02-05 09:29:19.000000000 -0500 ++++ dietlibc-0.26/x86_64/start.S 2004-08-07 18:52:39.000000000 -0400 +@@ -35,6 +35,10 @@ _start: + popq %rdi + #endif + ++#ifdef __dietlibc__ ++ call __guard_setup ++#endif ++ + #ifdef WANT_DYNAMIC + call _dyn_start + #else diff --git a/dev-libs/dietlibc/files/digest-dietlibc-0.26-r1 b/dev-libs/dietlibc/files/digest-dietlibc-0.26-r1 new file mode 100644 index 000000000000..bedd79836fbe --- /dev/null +++ b/dev-libs/dietlibc/files/digest-dietlibc-0.26-r1 @@ -0,0 +1 @@ +MD5 68a4d1685dfc6d36ed12a5d5bb91fb80 dietlibc-0.26.tar.bz2 525208 diff --git a/dev-libs/dietlibc/files/ssp.c b/dev-libs/dietlibc/files/ssp.c new file mode 100644 index 000000000000..1a8910c0af7a --- /dev/null +++ b/dev-libs/dietlibc/files/ssp.c @@ -0,0 +1,166 @@ +/* + * Distributed under the terms of the GNU General Public License v2 + * $Header: /var/cvsroot/gentoo-x86/dev-libs/dietlibc/files/ssp.c,v 1.1 2004/08/07 23:30:19 solar Exp $ + * + * This is a modified version of Hiroaki Etoh's stack smashing routines + * implemented for glibc. + * + * The following people have contributed input to this code. + * Ned Ludd - <solar[@]gentoo.org> + * Alexander Gabert - <pappy[@]gentoo.org> + * The PaX Team - <pageexec[@]freemail.hu> + * Peter S. Mazinger - <ps.m[@]gmx.net> + * Yoann Vandoorselaere - <yoann[@]prelude-ids.org> + * Robert Connolly - <robert[@]linuxfromscratch.org> + * Cory Visi <cory@visi.name> + * + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <stdio.h> +#include <string.h> +#include <fcntl.h> +#include <unistd.h> +#include <signal.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/un.h> +#include <sys/syslog.h> +#include <sys/time.h> +#include <sys/sysctl.h> + +#ifndef _PATH_LOG +#define _PATH_LOG "/dev/log" +#endif + +#ifdef __PROPOLICE_BLOCK_SEGV__ +#define SSP_SIGTYPE SIGSEGV +#elif __PROPOLICE_BLOCK_KILL__ +#define SSP_SIGTYPE SIGKILL +#else +#define SSP_SIGTYPE SIGABRT +#endif + +unsigned long __guard = 0UL; + +void +__guard_setup (void) +{ + size_t size; +#ifdef HAVE_DEV_ERANDOM + int mib[3]; +#endif + + if (__guard != 0UL) + return; + +#ifndef __SSP_QUICK_CANARY__ +#ifdef HAVE_DEV_ERANDOM + /* Random is another depth in Linux, hence an array of 3. */ + mib[0] = CTL_KERN; + mib[1] = KERN_RANDOM; + mib[2] = RANDOM_ERANDOM; + + size = sizeof (unsigned long); + if (__sysctl (mib, 3, &__guard, &size, NULL, 0) != (-1)) + if (__guard != 0UL) + return; +#endif + /* + * Attempt to open kernel pseudo random device if one exists before + * opening urandom to avoid system entropy depletion. + */ + { + int fd; +#ifdef HAVE_DEV_ERANDOM + if ((fd = open ("/dev/erandom", O_RDONLY)) == (-1)) +#endif + fd = open ("/dev/urandom", O_RDONLY); + if (fd != (-1)) + { + size = read (fd, (char *) &__guard, sizeof (__guard)); + close (fd); + if (size == sizeof (__guard)) + return; + } + } +#endif + + /* If sysctl was unsuccessful, use the "terminator canary". */ + __guard = 0xFF0A0D00UL; + + { + /* Everything failed? Or we are using a weakened model of the + * terminator canary */ + struct timeval tv; + + gettimeofday (&tv, NULL); + __guard ^= tv.tv_usec ^ tv.tv_sec; + } +} + +void +__stack_smash_handler (char func[], int damaged) +{ + struct sigaction sa; + const char message[] = ": stack smashing attack in function "; + int bufsz, len; + char buf[512]; +#ifndef __dietlibc__ + struct sockaddr_un sock; /* AF_UNIX address of local logger */ + int log; + extern char *__progname; +#else + static char *__progname = "dietapp"; +#endif + + sigset_t mask; + sigfillset (&mask); + + sigdelset (&mask, SSP_SIGTYPE); /* Block all signal handlers */ + sigprocmask (SIG_BLOCK, &mask, NULL); /* except SIGABRT */ + + bufsz = sizeof (buf); + strcpy (buf, "<2>"); + len = 3; + + strncat (buf, __progname, sizeof (buf) - 4); + len = strlen (buf); + + if (bufsz > len) + { + strncat (buf, message, bufsz - len - 1); + len = strlen (buf); + } + if (bufsz > len) + { + strncat (buf, func, bufsz - len - 1); + len = strlen (buf); + } + + /* print error message */ + write (STDERR_FILENO, buf + 3, len - 3); + write (STDERR_FILENO, "()\n", 3); +#ifndef __dietlibc__ + if ((log = socket (AF_UNIX, SOCK_DGRAM, 0)) != -1) + { + /* Send "found" message to the "/dev/log" path */ + sock.sun_family = AF_UNIX; + (void) strncpy (sock.sun_path, _PATH_LOG, sizeof (sock.sun_path) - 1); + sock.sun_path[sizeof (sock.sun_path) - 1] = '\0'; + sendto (log, buf, len, 0, (struct sockaddr *) &sock, sizeof (sock)); + } +#endif + /* Make sure the default handler is associated with the our signal handler */ + + memset (&sa, 0, sizeof (struct sigaction)); + sigfillset (&sa.sa_mask); /* Block all signals */ + sa.sa_flags = 0; + sa.sa_handler = SIG_DFL; + sigaction (SSP_SIGTYPE, &sa, NULL); + (void) kill (getpid (), SSP_SIGTYPE); + _exit (127); +} |