diff options
Diffstat (limited to 'dev-libs/uclibc')
-rw-r--r-- | dev-libs/uclibc/ChangeLog | 7 | ||||
-rw-r--r-- | dev-libs/uclibc/Manifest | 25 | ||||
-rw-r--r-- | dev-libs/uclibc/files/0.9.26/ssp.c | 160 | ||||
-rw-r--r-- | dev-libs/uclibc/files/0.9.26/uClibc-20040613-do_rem.patch | 12 | ||||
-rw-r--r-- | dev-libs/uclibc/files/0.9.26/uclibc-0.9.26-ssp-gcc34-after-frandom.patch | 19 | ||||
-rw-r--r-- | dev-libs/uclibc/files/digest-uclibc-0.9.26-r2 | 3 | ||||
-rw-r--r-- | dev-libs/uclibc/uclibc-0.9.26-r2.ebuild | 223 |
7 files changed, 438 insertions, 11 deletions
diff --git a/dev-libs/uclibc/ChangeLog b/dev-libs/uclibc/ChangeLog index 6bd9c3c17a42..bf302d73d0b8 100644 --- a/dev-libs/uclibc/ChangeLog +++ b/dev-libs/uclibc/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for dev-libs/uclibc # Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/uclibc/ChangeLog,v 1.20 2004/05/26 04:02:54 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-libs/uclibc/ChangeLog,v 1.21 2004/06/23 02:14:07 solar Exp $ + + 22 Jun 2004; <solar@gentoo.org> files/0.9.26/ssp.c, + files/0.9.26/uClibc-20040613-do_rem.patch, + files/0.9.26/uclibc-0.9.26-ssp-gcc34-after-frandom.patch: + major uclibc cleanups. New IUSE= flags and functionality 26 May 2004; Mike Frysinger <vapier@gentoo.org> +files/0.9.26/arm-fix-missing-syscalls.patch, uclibc-0.9.26-r1.ebuild: diff --git a/dev-libs/uclibc/Manifest b/dev-libs/uclibc/Manifest index 8b915fefbf61..618aa173c0ac 100644 --- a/dev-libs/uclibc/Manifest +++ b/dev-libs/uclibc/Manifest @@ -1,13 +1,18 @@ -MD5 17ecd222df47b5253f35787097440a5a files/0.9.23/uClibc-0.9.23-etdyn.patch 5832 -MD5 298b7b42f80e1f8ae395df81c47eb213 files/0.9.23/uClibc-0.9.23-flipturn.patch 1821 -MD5 4216cdf86d54f45fa04cb44a5425b3ff files/0.9.23/uClibc-0.9.23-pax.patch 3607 +MD5 46d61a42811b3501b0698e92fbda047f uclibc-0.9.26-r2.ebuild 6125 +MD5 3783c027ae7ce204176e87ec250a59f3 uclibc-0.9.26-r1.ebuild 2550 +MD5 5edf3b9ecb6ec5bc4628cc1240bbb66b ChangeLog 4435 +MD5 5e376ebb178aae5f2f7b29da2b0b7917 uclibc-0.9.21.ebuild 1082 +MD5 f694d40cf09e6c5511ae52f755a5ffe5 metadata.xml 998 MD5 d16f404e56abc9f0ab5c372b88a6905d files/Makefile-cp-order-fix.patch 897 +MD5 821b203c91a4cc87f7ea554a5c747af8 files/digest-uclibc-0.9.26-r1 153 +MD5 02ffb023d5b3be46c7e0c9aadf48d304 files/digest-uclibc-0.9.26-r2 231 MD5 799adc7fb6ec9ffd653831cea1d32dd5 files/digest-uclibc-0.9.21 67 -MD5 2416f5e954ccb8b39b1c0d6a3cf5e827 files/0.9.26/uClibc-0.9.26-Makefile.patch 1478 -MD5 bdd1e91ee48fb8be0d28cabdfcfdf3ff files/0.9.26/uClibc-0.9.26-pie-option.patch 863 +MD5 4216cdf86d54f45fa04cb44a5425b3ff files/0.9.23/uClibc-0.9.23-pax.patch 3607 +MD5 17ecd222df47b5253f35787097440a5a files/0.9.23/uClibc-0.9.23-etdyn.patch 5832 +MD5 298b7b42f80e1f8ae395df81c47eb213 files/0.9.23/uClibc-0.9.23-flipturn.patch 1821 +MD5 75b0564e75dfe204b729f0fa80481f00 files/0.9.26/ssp.c 3935 MD5 49671ccbdf2c8055efc6cde0003cb6c5 files/0.9.26/arm-fix-missing-syscalls.patch 2264 -MD5 821b203c91a4cc87f7ea554a5c747af8 files/digest-uclibc-0.9.26-r1 153 -MD5 2bb467ed0a5fb58849bc13c26a0dea74 ChangeLog 4217 -MD5 f694d40cf09e6c5511ae52f755a5ffe5 metadata.xml 998 -MD5 016c81b475f0e47a8a529412a17a3adb uclibc-0.9.21.ebuild 1083 -MD5 32052e600f88667916327a5e371e3a99 uclibc-0.9.26-r1.ebuild 2551 +MD5 874260fc77637deccf7588cfc1c76674 files/0.9.26/uClibc-20040613-do_rem.patch 391 +MD5 d35beaf332590fed8c619483d4598dc6 files/0.9.26/uclibc-0.9.26-ssp-gcc34-after-frandom.patch 542 +MD5 bdd1e91ee48fb8be0d28cabdfcfdf3ff files/0.9.26/uClibc-0.9.26-pie-option.patch 863 +MD5 2416f5e954ccb8b39b1c0d6a3cf5e827 files/0.9.26/uClibc-0.9.26-Makefile.patch 1478 diff --git a/dev-libs/uclibc/files/0.9.26/ssp.c b/dev-libs/uclibc/files/0.9.26/ssp.c new file mode 100644 index 000000000000..cabde2ad0282 --- /dev/null +++ b/dev-libs/uclibc/files/0.9.26/ssp.c @@ -0,0 +1,160 @@ +/* + * Distributed under the terms of the GNU General Public License v2 + * $Header: /var/cvsroot/gentoo-x86/dev-libs/uclibc/files/0.9.26/ssp.c,v 1.1 2004/06/23 02:14:08 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 sockaddr_un sock; /* AF_UNIX address of local logger */ + struct sigaction sa; + const char message[] = ": stack smashing attack in function "; + int bufsz, len, log; + char buf[512]; + extern char *__progname; + + 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); + 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)); + } + + /* 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); +} diff --git a/dev-libs/uclibc/files/0.9.26/uClibc-20040613-do_rem.patch b/dev-libs/uclibc/files/0.9.26/uClibc-20040613-do_rem.patch new file mode 100644 index 000000000000..399350ff5de7 --- /dev/null +++ b/dev-libs/uclibc/files/0.9.26/uClibc-20040613-do_rem.patch @@ -0,0 +1,12 @@ +--- a/ldso/include/dl-string.h 12 Jun 2004 08:38:38 -0000 1.5 ++++ b/ldso/include/dl-string.h 19 Jun 2004 01:55:06 -0000 +@@ -1,6 +1,8 @@ + #ifndef _LINUX_STRING_H_ + #define _LINUX_STRING_H_ + ++#include <dl-sysdep.h> // for do_rem ++ + static size_t _dl_strlen(const char * str); + static char *_dl_strcat(char *dst, const char *src); + static char * _dl_strcpy(char * dst,const char *src); + diff --git a/dev-libs/uclibc/files/0.9.26/uclibc-0.9.26-ssp-gcc34-after-frandom.patch b/dev-libs/uclibc/files/0.9.26/uclibc-0.9.26-ssp-gcc34-after-frandom.patch new file mode 100644 index 000000000000..b3619d079ece --- /dev/null +++ b/dev-libs/uclibc/files/0.9.26/uclibc-0.9.26-ssp-gcc34-after-frandom.patch @@ -0,0 +1,19 @@ +--- ./libc/sysdeps/linux/common/ssp.c.old 2004-05-17 06:46:31.000000000 -0400 ++++ ./libc/sysdeps/linux/common/ssp.c 2004-05-17 07:46:42.264773000 -0400 +@@ -44,9 +44,15 @@ + #define SSP_SIGTYPE SIGABRT + #endif + ++#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) ++#define __attribute_used__ __attribute__((__used__)) ++#else ++#define __attribute_used__ __attribute__((__unused__)) ++#endif ++ + unsigned long __guard = 0UL; + +-void ++__attribute_used__ void __attribute__ ((visibility ("default"))) + __guard_setup (void) + { + size_t size; diff --git a/dev-libs/uclibc/files/digest-uclibc-0.9.26-r2 b/dev-libs/uclibc/files/digest-uclibc-0.9.26-r2 new file mode 100644 index 000000000000..15b22bafbd5f --- /dev/null +++ b/dev-libs/uclibc/files/digest-uclibc-0.9.26-r2 @@ -0,0 +1,3 @@ +MD5 7212713c432dd0de6ec2140c2a6212e4 uClibc-0.9.26.tar.bz2 1604543 +MD5 9d838fe97871b69e1fc7b78e15421457 uClibc-0.9.26-cvs-update-20040613.patch.bz2 285917 +MD5 b7820c6b79f02d2d07a7ac75abfe90a5 uClibc-0.9.26-patches-1.1.tar.bz2 7162 diff --git a/dev-libs/uclibc/uclibc-0.9.26-r2.ebuild b/dev-libs/uclibc/uclibc-0.9.26-r2.ebuild new file mode 100644 index 000000000000..07f4e32fd071 --- /dev/null +++ b/dev-libs/uclibc/uclibc-0.9.26-r2.ebuild @@ -0,0 +1,223 @@ +# Copyright 1999-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/uclibc/uclibc-0.9.26-r2.ebuild,v 1.1 2004/06/23 02:14:07 solar Exp $ + +inherit eutils flag-o-matic gcc + +MY_P="${P/ucl/uCl}" +DESCRIPTION="C library for developing embedded Linux systems" +HOMEPAGE="http://www.uclibc.org/" +SRC_URI="http://www.kernel.org/pub/linux/libs/uclibc/${MY_P}.tar.bz2" + +CVS_VER="20040613" +SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-cvs-update-${CVS_VER}.patch.bz2" + +PATCH_VER="1.1" +SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-patches-${PATCH_VER}.tar.bz2" + +LICENSE="LGPL-2" +SLOT="0" +KEYWORDS="~x86 ~ppc ~sparc ~mips ~arm" +IUSE="build ipv6 uclibc hardened" # nls is not supported yet + +DEPEND="sys-devel/gcc" +PROVIDE="virtual/glibc" + +S=${WORKDIR}/${MY_P} + +check_main_libc() { + if [ -f /lib/lib${MY_P}.so -a ! -f /lib/libc.so.6 ] ; then + if echo "${CHOST}" | grep -q uclibc ; then + retval=0 + else + retval=1 + fi + else + retval=1 + fi + [ "${retval}" = "0" ] && SYS_LIBC=uClibc || SYS_LIBC=glibc + echo + einfo "We are building for ${SYS_LIBC} system library" + echo +} + +src_unpack() { + unpack ${A} + cd ${S} + + if [ -n "${CVS_VER}" ] + then + epatch ${DISTDIR}/${MY_P}-cvs-update-${CVS_VER}.patch.bz2 + epatch ${FILESDIR}/0.9.26/uClibc-20040613-do_rem.patch + fi + + cp ${FILESDIR}/0.9.26/ssp.c ${S}/libc/sysdeps/linux/common/ || \ + die "failed to copy ssp.c to ${S}/libc/sysdeps/linux/common/" + # gcc 3.4 nukes ssp without this patch + if [ "`gcc-major-version`" -ge "3" -a "`gcc-minor-version`" -ge "4" ] + then + epatch ${FILESDIR}/0.9.26/uclibc-0.9.26-ssp-gcc34-after-frandom.patch + fi + + if [ -n "${PATCH_VER}" ] + then + unpack ${MY_P}-patches-${PATCH_VER}.tar.bz2 + # for now we remove relro/now, no support for relro in ldso + rm -f ${WORKDIR}/patch/*relro* + rm -f ${WORKDIR}/patch/*now* + # remove default ssp build + use hardened || rm -f ${WORKDIR}/patch/*enable-ssp* + epatch ${WORKDIR}/patch + fi + + # support archs which dont implement all syscalls + [ -z "${CVS_VER}" ] && epatch ${FILESDIR}/${PV}/arm-fix-missing-syscalls.patch + + # fixup for install perms + sed -i -e "s:-fa:-dRf:g" Makefile + + local target="" + if [ "${ARCH}" == "x86" ] ; then + target="i386" + elif [ "${ARCH}" == "ppc" ] ; then + target="powerpc" + else + # sparc|mips|alpha|arm|sh + target="${ARCH}" + fi + sed -i \ + -e "s:default TARGET_i386:default TARGET_${target}:" \ + extra/Configs/Config.in + sed -i \ + -e "s:default CONFIG_GENERIC_386:default CONFIG_${UCLIBC_CPU:-GENERIC_386}:" \ + extra/Configs/Config.${target} + + make defconfig >/dev/null || die "could not config" + + # this could be a debug flag + for def in UCLIBC_PROFILING DO{DEBUG,ASSERTS} SUPPORT_LD_DEBUG{,_EARLY} ; do + sed -i -e "s:${def}=y:# ${def} is not set:" .config + done + + for def in DO_C99_MATH UCLIBC_HAS_{RPC,CTYPE_CHECKED,WCHAR,HEXADECIMAL_FLOATS,GLIBC_CUSTOM_PRINTF,FOPEN_EXCLUSIVE_MODE,GLIBC_CUSTOM_STREAMS,PRINTF_M_SPEC,FTW} ; do + sed -i -e "s:# ${def} is not set:${def}=y:" .config + done + echo "UCLIBC_HAS_FULL_RPC=n" >> .config + + #if use nls + #then + # sed -i -e "s:# UCLIBC_HAS_LOCALE is not set:UCLIBC_HAS_LOCALE=y:" .config + # echo "UCLIBC_HAS_XLOCALE=n" >> .config + # echo "UCLIBC_HAS_GLIBC_DIGIT_GROUPING=y" >> .config + # echo "UCLIBC_HAS_SCANF_LENIENT_DIGIT_GROUPING=y" >> .config + # echo "UCLIBC_HAS_GETTEXT_AWARENESS=y" >> .config + # # on pax enabled kernels the locale files can't be built + # echo "UCLIBC_PREGENERATED_LOCALE_DATA=n" >> .config + #fi + # we disable LOCALE for any case, gettext has to be used + echo "UCLIBC_HAS_LOCALE=n" >> .config + + use ipv6 && sed -i -e "s:# UCLIBC_HAS_IPV6 is not set:UCLIBC_HAS_IPV6=y:" .config + + if use hardened + then + if use x86 + then + einfo "Enable Position Independent Executable support in ${P}" + sed -i -e "s:# UCLIBC_PIE_SUPPORT.*:UCLIBC_PIE_SUPPORT=y:" .config + fi + + einfo "Enable Stack Smashing Protections support in ${P}" + sed -i -e "s:# UCLIBC_PROPOLICE.*:UCLIBC_PROPOLICE=y:" .config + echo "PROPOLICE_BLOCK_ABRT=n" >> .config + echo "PROPOLICE_BLOCK_SEGV=n" >> .config + echo "PROPOLICE_BLOCK_KILL=y" >> .config + fi + + # we are building against system installed kernel headers + sed -i -e 's:KERNEL_SOURCE.*:KERNEL_SOURCE="/usr":' .config + + check_main_libc + if [ "${SYS_LIBC}" = "uClibc" ] + then + sed -i -e 's:SHARED_LIB_LOADER_PREFIX=.*:SHARED_LIB_LOADER_PREFIX="/lib":' .config + sed -i -e 's:DEVEL_PREFIX=.*:DEVEL_PREFIX="/usr":' .config + sed -i -e 's:RUNTIME_PREFIX=.*:RUNTIME_PREFIX="/":' .config + fi + + make -s oldconfig > /dev/null || die "could not make oldconfig" + + chmod +x extra/scripts/relative_path.sh + + cp .config myconfig + + emake clean >/dev/null || die "could not clean" +} + +src_compile() { + # running tests require this + use build || addwrite /dev/ptmx + mv myconfig .config + + #if use nls + #then + # # these can be built only if the build system supports locales (as of 0.9.26) + # emake -j1 headers + # cd extra/locale + # make clean + # find ./charmaps -name "*.pairs" > codesets.txt + # cp LOCALES locales.txt + # emake -j1 || die "could not make locales" + # cd ../.. + #fi + + emake -j1 || die "could not make" + if ! use build + then + if [ "${SYS_LIBC}" = "uClibc" ] + then + emake -j1 utils || die "could not make utils" + fi + # assert test fails on pax enabled kernels - normal + # vfork test fails in sandbox + cd test; make; cd .. + fi +} + +src_install() { + emake PREFIX=${D} install || die "install failed" + + # remove files coming from kernel-headers + # scsi is uclibc's own directory since cvs 20040212 + if [ "${SYS_LIBC}" = "uClibc" ] + then + rm -rf ${D}/usr/include/{asm,linux} + fi + + rm -f ${D}/usr/lib/lib*_pic.a + + if ! use build + then + if [ "${SYS_LIBC}" = "uClibc" ] + then + emake PREFIX=${D} install_utils || die "install-utils failed" + dodir /usr/bin + exeinto /usr/bin + doexe ${FILESDIR}/getent + fi + dodoc Changelog* README TODO docs/*.txt + doman debian/*.1 + fi +} + +#pkg_postinst() { +#if [ "${SYS_LIBC}" = "uClibc" ] ; then +# if [ "${ROOT}" = "/" ] ; then +# /sbin/ldconfig +# [ ! -e /etc/TZ ] && echo UTC > /etc/TZ +# # reload init? +# fi +#else +#should we add the lib dir to ld.so.conf? +#fi +#} |