diff options
author | 2009-09-20 02:57:50 +0000 | |
---|---|---|
committer | 2009-09-20 02:57:50 +0000 | |
commit | 3502e5efab54bdb67f9a9e51b937678a00a6a3a4 (patch) | |
tree | f526b587eff3f67015397579eaed0242c2701676 /sys-libs/glibc | |
parent | Keyword ~amd64. (diff) | |
download | historical-3502e5efab54bdb67f9a9e51b937678a00a6a3a4.tar.gz historical-3502e5efab54bdb67f9a9e51b937678a00a6a3a4.tar.bz2 historical-3502e5efab54bdb67f9a9e51b937678a00a6a3a4.zip |
fix missing gentoo-chk_fail and update it to be 2.10 rather then keeping
it in 2.6.
Package-Manager: portage-2.1.6.13/cvs/Linux x86_64
Diffstat (limited to 'sys-libs/glibc')
-rw-r--r-- | sys-libs/glibc/ChangeLog | 7 | ||||
-rw-r--r-- | sys-libs/glibc/Manifest | 5 | ||||
-rw-r--r-- | sys-libs/glibc/files/2.10/glibc-2.10-gentoo-chk_fail.c | 315 | ||||
-rw-r--r-- | sys-libs/glibc/glibc-2.10.1.ebuild | 4 |
4 files changed, 326 insertions, 5 deletions
diff --git a/sys-libs/glibc/ChangeLog b/sys-libs/glibc/ChangeLog index 7ba58f53b803..acfb1136bf8a 100644 --- a/sys-libs/glibc/ChangeLog +++ b/sys-libs/glibc/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for sys-libs/glibc # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/ChangeLog,v 1.643 2009/09/20 02:25:19 anarchy Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/ChangeLog,v 1.644 2009/09/20 02:57:50 anarchy Exp $ + + 20 Sep 2009; Jory A. Pratt <anarchy@gentoo.org> glibc-2.10.1.ebuild, + +files/2.10/glibc-2.10-gentoo-chk_fail.c: + rename broken glibc-2.6-gentoo_chk_fail.c to glibc-2.10-gentoo_chk_fail.c + and update ebuild. 20 Sep 2009; Jory A. Pratt <anarchy@gentoo.org> glibc-2.10.1.ebuild, +files/2.10/glibc-2.10-hardened-configure-picdefault.patch, diff --git a/sys-libs/glibc/Manifest b/sys-libs/glibc/Manifest index 14e8c7b2f312..4d3b9acae2ee 100644 --- a/sys-libs/glibc/Manifest +++ b/sys-libs/glibc/Manifest @@ -1,3 +1,4 @@ +AUX 2.10/glibc-2.10-gentoo-chk_fail.c 9407 RMD160 230701dfacfe2481eb49e5384fe4ebb508bd3af2 SHA1 0e9330d57de714dd1ecd7040d3eabf4723cdee7c SHA256 7745c0f5d37b37959b43b41e39762fc35b877161bc5740d9d3e9a83021acbc0e AUX 2.10/glibc-2.10-hardened-configure-picdefault.patch 865 RMD160 744bdbfb73f1dbced4cb33cb5aa92f3b41d3b4fb SHA1 21e0f83598f5342032a794315f0e3dac07f647da SHA256 b50b29f85d88011555bbcbe6046e6600be9344f2d78412b14aebdea515420774 AUX 2.10/glibc-2.10-hardened-inittls-nosysenter.patch 8823 RMD160 163e53f0f4f0bd003ef1c50a4eaaa8f4a82695fe SHA1 df23c6756114e1451e6f120723af1b621037c28e SHA256 dcf78c6524c222dbee907200a8878aff727e29d43a4962b977a16d85752e5c10 AUX 2.10/glibc-2.10-hardened-ssp-compat.patch 4802 RMD160 02bd17455d64b6661ae5f44329357dc254cdf118 SHA1 b40cf1a8f17e448861746ba39aa20afd66a47b2d SHA256 bd6f0aa8eace0a935731749e101d5fe30210f9edb65f2f5ccd425cef581ddce4 @@ -189,7 +190,7 @@ DIST glibc-ports-2.6.1.tar.bz2 431292 RMD160 aa6ba7bc58932c81416c3407a8dd0b5e61f DIST glibc-ports-2.6.tar.bz2 431332 RMD160 275a10d95b5fa34a7c37469468eddbca928fa225 SHA1 ebc15149c8f6f492256cfab585f969a222e2f396 SHA256 398f56ad651939110ad6af88fdd3e92b5cb0583e6f612f2f12ba0134a22b1fac DIST glibc-ports-2.7.tar.bz2 435392 RMD160 b9b96b357a394f29d5617aaa26a2c000bcf88874 SHA1 2186eac2248f1dd604f20a9dc8215ce12319d273 SHA256 3e481996259af87c3581da23481970a27de679e3c87cfa9a5a59751cd20c7b44 DIST glibc-powerpc-cpu-addon-v0.01.tgz 22422 RMD160 3483c94ec55819b36aa66fc60462317f8d15e4df SHA1 fd30cde7c7cb42baa2c8fa1ac88eeeeb509cac29 SHA256 0ffa9a432fffb9bfed99c529b631a27534ba848c7ec1d707732338b73a4a8ce9 -EBUILD glibc-2.10.1.ebuild 8080 RMD160 b7125a952ca27d93fdac121f678e9817dbd98bc5 SHA1 879f5071f2b93648d56ac555d1f5253c4180966c SHA256 af1d5967681089460fa297d4f06eb222227d0adf303865abd05f785863a6a04f +EBUILD glibc-2.10.1.ebuild 8082 RMD160 1e2ff393e2290412cc6392451c1169755bae84e8 SHA1 b74f3c6533f1ccc1ff720f0866a1e6670f8a4fd4 SHA256 3886ebe64b8cddfc5a2abd7153c7807f2ceec1ec4904b15bcb7e456b35652bf4 EBUILD glibc-2.2.5-r10.ebuild 4845 RMD160 aac21107eada185cd0d732414543a4e52676fae6 SHA1 b9d514afa456f93233b0a437ae90512eb9784da0 SHA256 a91c13db667c4f2f5178eb9253d90e101ffb37c7db3b811f30692a681c4f19be EBUILD glibc-2.3.2-r12.ebuild 22126 RMD160 ea9d0512b19289efe37e52e8edec5d7044fb9fd2 SHA1 126ed425af51b84fe041e2702af08f6dcdd5e74f SHA256 a5db6f8c648045e9df462f69b360ae877efcdc1be6dd63f7bb91455b1bac5bd7 EBUILD glibc-2.3.5-r3.ebuild 39024 RMD160 00d8523b78c0f417d326bca5795bd9eae6e279bc SHA1 bbdd9924c2d0805743eecd14bc524232424d6e5d SHA256 c6789db55f562cfb848bfd071133e03bcd81da85788ac6e5a0d92dcd5558654d @@ -209,5 +210,5 @@ EBUILD glibc-2.9_p20081201-r1.ebuild 13638 RMD160 499cb90beb840dec3630096628a38e EBUILD glibc-2.9_p20081201-r2.ebuild 7734 RMD160 a782a26d91a7bfaace730698e60df268cc4e1ed9 SHA1 70ed91a39adc64d6b81234b5787de17e1d8a0ee5 SHA256 421a8da60e127367a7ef4c4ddb5a5e28093d793294acfe6698fd1ef57a8ac25b EBUILD glibc-2.9_p20081201-r3.ebuild 7766 RMD160 1d870090445e989fa2965a570c1899443e422a6c SHA1 5def44ecc650bed9b9ce8c5e3aa5acfc6c8c4ab6 SHA256 73925c0794ed85c610a65443a02768ffee60f90d8b607d99a0926aa8b170eb9b EBUILD glibc-2.9_p20081201.ebuild 13449 RMD160 ba463ccf508a887cab638d7f65aa809dd1933a2b SHA1 0e7798f24c20e8baaae9fac47c3322eae4e2dda1 SHA256 2da6944caf8bc892bcc05b64eee224946baff8d65e375587dac3582d22766e58 -MISC ChangeLog 119942 RMD160 6f7d6e214b7d20211596a150c7a8a868b5cba1e7 SHA1 83964f9091c782531de2471169ec4a8cdd8e539d SHA256 1ec2e2f670041ffe44998731fa98aadb385649ef73c31a696738a83cff7e7a72 +MISC ChangeLog 120155 RMD160 68c7631f360460126d87437f0171b717941a13c8 SHA1 a04eb8f0ea8cf839617806b23a1b33b26a9e3148 SHA256 7c800acf620a99c797b9c26ba571e9855d448111d9560158616ac27ecc01748f MISC metadata.xml 1112 RMD160 1aa9770356149948593ebe35a1bd3940dd72fca2 SHA1 40514cc45c26bab671d78aa1567441bf72b0c6cc SHA256 4acea698dc4f66c17f4f3f81b28cd6b32f5425fd49f380df4a016489f786b1f5 diff --git a/sys-libs/glibc/files/2.10/glibc-2.10-gentoo-chk_fail.c b/sys-libs/glibc/files/2.10/glibc-2.10-gentoo-chk_fail.c new file mode 100644 index 000000000000..37711e8aacbf --- /dev/null +++ b/sys-libs/glibc/files/2.10/glibc-2.10-gentoo-chk_fail.c @@ -0,0 +1,315 @@ +/* Copyright (C) 2004, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +/* Copyright (C) 2006-2008 Gentoo Foundation Inc. + * License terms as above. + * + * Hardened Gentoo SSP and FORTIFY handler + * + * An SSP failure handler that does not use functions from the rest of + * glibc; it uses the INTERNAL_SYSCALL methods directly. This ensures + * no possibility of recursion into the handler. + * + * Direct all bug reports to http://bugs.gentoo.org/ + * + * Re-written from the glibc-2.3 Hardened Gentoo SSP handler + * by Kevin F. Quinn - <kevquinn[@]gentoo.org> + * + * The following people contributed to the glibc-2.3 Hardened + * Gentoo SSP and FORTIFY handler, from which this implementation draws much: + * + * 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> + * Mike Frysinger <vapier[@]gentoo.org> + * Magnus Granberg <zorry[@]ume.nu> + */ + +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <unistd.h> +#include <signal.h> + +#include <sys/types.h> + +#include <sysdep-cancel.h> +#include <sys/syscall.h> +#include <bp-checks.h> + +#include <kernel-features.h> + +#include <alloca.h> +/* from sysdeps */ +#include <socketcall.h> +/* for the stuff in bits/socket.h */ +#include <sys/socket.h> +#include <sys/un.h> + +/* Sanity check on SYSCALL macro names - force compilation + * failure if the names used here do not exist + */ +#if !defined __NR_socketcall && !defined __NR_socket +# error Cannot do syscall socket or socketcall +#endif +#if !defined __NR_socketcall && !defined __NR_connect +# error Cannot do syscall connect or socketcall +#endif +#ifndef __NR_write +# error Cannot do syscall write +#endif +#ifndef __NR_close +# error Cannot do syscall close +#endif +#ifndef __NR_getpid +# error Cannot do syscall getpid +#endif +#ifndef __NR_kill +# error Cannot do syscall kill +#endif +#ifndef __NR_exit +# error Cannot do syscall exit +#endif +#ifdef SSP_SMASH_DUMPS_CORE +# define ENABLE_SSP_SMASH_DUMPS_CORE 1 +# if !defined _KERNEL_NSIG && !defined _NSIG +# error No _NSIG or _KERNEL_NSIG for rt_sigaction +# endif +# if !defined __NR_sigaction && !defined __NR_rt_sigaction +# error Cannot do syscall sigaction or rt_sigaction +# endif +/* Although rt_sigaction expects sizeof(sigset_t) - it expects the size + * of the _kernel_ sigset_t which is not the same as the user sigset_t. + * Most arches have this as _NSIG bits - mips has _KERNEL_NSIG bits for + * some reason. + */ +# ifdef _KERNEL_NSIG +# define _SSP_NSIG _KERNEL_NSIG +# else +# define _SSP_NSIG _NSIG +# endif +#else +# define _SSP_NSIG 0 +# define ENABLE_SSP_SMASH_DUMPS_CORE 0 +#endif + +/* Define DO_SIGACTION - default to newer rt signal interface but + * fallback to old as needed. + */ +#ifdef __NR_rt_sigaction +# define DO_SIGACTION(signum, act, oldact) \ + INLINE_SYSCALL(rt_sigaction, 4, signum, act, oldact, _SSP_NSIG/8) +#else +# define DO_SIGACTION(signum, act, oldact) \ + INLINE_SYSCALL(sigaction, 3, signum, act, oldact) +#endif + +/* Define DO_SOCKET/DO_CONNECT functions to deal with socketcall vs socket/connect */ +#if defined(__NR_socket) && defined(__NR_connect) +# define USE_OLD_SOCKETCALL 0 +#else +# define USE_OLD_SOCKETCALL 1 +#endif + +/* stub out the __NR_'s so we can let gcc optimize away dead code */ +#ifndef __NR_socketcall +# define __NR_socketcall 0 +#endif +#ifndef __NR_socket +# define __NR_socket 0 +#endif +#ifndef __NR_connect +# define __NR_connect 0 +#endif +#define DO_SOCKET(result, domain, type, protocol) \ + do { \ + if (USE_OLD_SOCKETCALL) { \ + socketargs[0] = domain; \ + socketargs[1] = type; \ + socketargs[2] = protocol; \ + socketargs[3] = 0; \ + result = INLINE_SYSCALL(socketcall, 2, SOCKOP_socket, socketargs); \ + } else \ + result = INLINE_SYSCALL(socket, 3, domain, type, protocol); \ + } while (0) +#define DO_CONNECT(result, sockfd, serv_addr, addrlen) \ + do { \ + if (USE_OLD_SOCKETCALL) { \ + socketargs[0] = sockfd; \ + socketargs[1] = (unsigned long int)serv_addr; \ + socketargs[2] = addrlen; \ + socketargs[3] = 0; \ + result = INLINE_SYSCALL(socketcall, 2, SOCKOP_connect, socketargs); \ + } else \ + result = INLINE_SYSCALL(connect, 3, sockfd, serv_addr, addrlen); \ + } while (0) + +#ifndef _PATH_LOG +# define _PATH_LOG "/dev/log" +#endif + +static const char path_log[] = _PATH_LOG; + +/* For building glibc with SSP switched on, define __progname to a + * constant if building for the run-time loader, to avoid pulling + * in more of libc.so into ld.so + */ +#ifdef IS_IN_rtld +static char *__progname = "<rtld>"; +#else +extern char *__progname; +#endif + +/* Common handler code, used by chk_fail + * Inlined to ensure no self-references to the handler within itself. + * Data static to avoid putting more than necessary on the stack, + * to aid core debugging. + */ +__attribute__ ((__noreturn__ , __always_inline__)) +static inline void +__hardened_gentoo_chk_fail(char func[], int damaged) +{ +#define MESSAGE_BUFSIZ 256 + static pid_t pid; + static int plen, i; + static char message[MESSAGE_BUFSIZ]; + static const char msg_ssa[] = ": buffer overflow attack"; + static const char msg_inf[] = " in function "; + static const char msg_ssd[] = "*** buffer overflow detected ***: "; + static const char msg_terminated[] = " - terminated\n"; + static const char msg_report[] = "Report to http://bugs.gentoo.org/\n"; + static const char msg_unknown[] = "<unknown>"; + static int log_socket, connect_result; + static struct sockaddr_un sock; + static unsigned long int socketargs[4]; + + /* Build socket address + */ + sock.sun_family = AF_UNIX; + i = 0; + while ((path_log[i] != '\0') && (i<(sizeof(sock.sun_path)-1))) { + sock.sun_path[i] = path_log[i]; + i++; + } + sock.sun_path[i] = '\0'; + + /* Try SOCK_DGRAM connection to syslog */ + connect_result = -1; + DO_SOCKET(log_socket, AF_UNIX, SOCK_DGRAM, 0); + if (log_socket != -1) + DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock)); + if (connect_result == -1) { + if (log_socket != -1) + INLINE_SYSCALL(close, 1, log_socket); + /* Try SOCK_STREAM connection to syslog */ + DO_SOCKET(log_socket, AF_UNIX, SOCK_STREAM, 0); + if (log_socket != -1) + DO_CONNECT(connect_result, log_socket, &sock, sizeof(sock)); + } + + /* Build message. Messages are generated both in the old style and new style, + * so that log watchers that are configured for the old-style message continue + * to work. + */ +#define strconcat(str) \ + {i=0; while ((str[i] != '\0') && ((i+plen)<(MESSAGE_BUFSIZ-1))) \ + {\ + message[plen+i]=str[i];\ + i++;\ + }\ + plen+=i;} + + /* R.Henderson post-gcc-4 style message */ + plen = 0; + strconcat(msg_ssd); + if (__progname != (char *)0) + strconcat(__progname) + else + strconcat(msg_unknown); + strconcat(msg_terminated); + + /* Write out error message to STDERR, to syslog if open */ + INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen); + if (connect_result != -1) + INLINE_SYSCALL(write, 3, log_socket, message, plen); + + /* Dr. Etoh pre-gcc-4 style message */ + plen = 0; + if (__progname != (char *)0) + strconcat(__progname) + else + strconcat(msg_unknown); + strconcat(msg_ssa); + strconcat(msg_inf); + if (func != NULL) + strconcat(func) + else + strconcat(msg_unknown); + strconcat(msg_terminated); + /* Write out error message to STDERR, to syslog if open */ + INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen); + if (connect_result != -1) + INLINE_SYSCALL(write, 3, log_socket, message, plen); + + /* Direct reports to bugs.gentoo.org */ + plen=0; + strconcat(msg_report); + message[plen++]='\0'; + + /* Write out error message to STDERR, to syslog if open */ + INLINE_SYSCALL(write, 3, STDERR_FILENO, message, plen); + if (connect_result != -1) + INLINE_SYSCALL(write, 3, log_socket, message, plen); + + if (log_socket != -1) + INLINE_SYSCALL(close, 1, log_socket); + + /* Suicide */ + pid = INLINE_SYSCALL(getpid, 0); + + if (ENABLE_SSP_SMASH_DUMPS_CORE) { + static struct sigaction default_abort_act; + /* Remove any user-supplied handler for SIGABRT, before using it */ + default_abort_act.sa_handler = SIG_DFL; + default_abort_act.sa_sigaction = NULL; + __sigfillset(&default_abort_act.sa_mask); + default_abort_act.sa_flags = 0; + if (DO_SIGACTION(SIGABRT, &default_abort_act, NULL) == 0) + INLINE_SYSCALL(kill, 2, pid, SIGABRT); + } + + /* Note; actions cannot be added to SIGKILL */ + INLINE_SYSCALL(kill, 2, pid, SIGKILL); + + /* In case the kill didn't work, exit anyway + * The loop prevents gcc thinking this routine returns + */ + while (1) + INLINE_SYSCALL(exit, 0); +} + +__attribute__ ((__noreturn__)) +void __chk_fail(void) +{ + __hardened_gentoo_chk_fail(NULL, 0); +} + diff --git a/sys-libs/glibc/glibc-2.10.1.ebuild b/sys-libs/glibc/glibc-2.10.1.ebuild index 857b2b6836a5..6e70a1b1b791 100644 --- a/sys-libs/glibc/glibc-2.10.1.ebuild +++ b/sys-libs/glibc/glibc-2.10.1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.10.1.ebuild,v 1.6 2009/09/20 02:25:19 anarchy Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-libs/glibc/glibc-2.10.1.ebuild,v 1.7 2009/09/20 02:57:50 anarchy Exp $ inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib @@ -196,7 +196,7 @@ eblit-src_unpack-post() { einfo "Installing Hardened Gentoo SSP and FORTIFY_SOURCE handler" cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-stack_chk_fail.c \ debug/stack_chk_fail.c || die - cp -f "${FILESDIR}"/2.6/glibc-2.6-gentoo-chk_fail.c \ + cp -f "${FILESDIR}"/2.10/glibc-2.10-gentoo-chk_fail.c \ debug/chk_fail.c || die if use debug ; then |