From 77abb554dc040cbd6db740a48450a7719b609155 Mon Sep 17 00:00:00 2001 From: joerg Date: Thu, 21 Apr 2011 13:38:14 +0000 Subject: [PATCH] Disable Fortification for pthread and rump stubs. --- lib/libpthread/pthread_cancelstub.c | 43 ++++------------------------- lib/librumphijack/hijack.c | 29 ++++--------------- 2 files changed, 10 insertions(+), 62 deletions(-) diff --git a/lib/libpthread/pthread_cancelstub.c b/lib/libpthread/pthread_cancelstub.c index df3f8a2747b8..1f7cd6cded0b 100644 --- a/lib/libpthread/pthread_cancelstub.c +++ b/lib/libpthread/pthread_cancelstub.c @@ -1,4 +1,4 @@ -/* $NetBSD: pthread_cancelstub.c,v 1.33 2011/04/21 08:17:00 martin Exp $ */ +/* $NetBSD: pthread_cancelstub.c,v 1.34 2011/04/21 13:38:14 joerg Exp $ */ /*- * Copyright (c) 2002, 2007 The NetBSD Foundation, Inc. @@ -29,8 +29,11 @@ * POSSIBILITY OF SUCH DAMAGE. */ +/* Disable namespace mangling, Fortification is useless here anyway. */ +#undef _FORTIFY_SOURCE + #include -__RCSID("$NetBSD: pthread_cancelstub.c,v 1.33 2011/04/21 08:17:00 martin Exp $"); +__RCSID("$NetBSD: pthread_cancelstub.c,v 1.34 2011/04/21 13:38:14 joerg Exp $"); #ifndef lint @@ -50,8 +53,6 @@ __RCSID("$NetBSD: pthread_cancelstub.c,v 1.33 2011/04/21 08:17:00 martin Exp $") */ #define __LIBC12_SOURCE__ -#define __ssp_weak_name(fun) _cancelstub_ ## fun - #include #include #include @@ -470,40 +471,6 @@ pwrite(int d, const void *buf, size_t nbytes, off_t offset) return retval; } -#if _FORTIFY_SOURCE > 0 -#define STUB(fun) __ssp_weak_name(fun) -ssize_t _sys_readlink(const char * __restrict, char * __restrict, size_t); -ssize_t -STUB(readlink)(const char * __restrict path, char * __restrict buf, - size_t bufsiz) -{ - return _sys_readlink(path, buf, bufsiz); -} - -char *_sys_getcwd(char *, size_t); -char * -STUB(getcwd)(char *buf, size_t size) -{ - return _sys_getcwd(buf, size); -} -#else -#define STUB(fun) fun -#endif - -ssize_t -STUB(read)(int d, void *buf, size_t nbytes) -{ - ssize_t retval; - pthread_t self; - - self = pthread__self(); - TESTCANCEL(self); - retval = _sys_read(d, buf, nbytes); - TESTCANCEL(self); - - return retval; -} - ssize_t readv(int d, const struct iovec *iov, int iovcnt) { diff --git a/lib/librumphijack/hijack.c b/lib/librumphijack/hijack.c index d39c7630510a..01d6be5c4569 100644 --- a/lib/librumphijack/hijack.c +++ b/lib/librumphijack/hijack.c @@ -1,4 +1,4 @@ -/* $NetBSD: hijack.c,v 1.89 2011/04/21 08:21:13 martin Exp $ */ +/* $NetBSD: hijack.c,v 1.90 2011/04/21 13:38:14 joerg Exp $ */ /*- * Copyright (c) 2011 Antti Kantee. All Rights Reserved. @@ -25,10 +25,11 @@ * SUCH DAMAGE. */ -#include -__RCSID("$NetBSD: hijack.c,v 1.89 2011/04/21 08:21:13 martin Exp $"); +/* Disable namespace mangling, Fortification is useless here anyway. */ +#undef _FORTIFY_SOURCE -#define __ssp_weak_name(fun) _hijack_ ## fun +#include +__RCSID("$NetBSD: hijack.c,v 1.90 2011/04/21 13:38:14 joerg Exp $"); #include #include @@ -1970,26 +1971,6 @@ FDCALL(int, shutdown, DUALCALL_SHUTDOWN, \ (int, int), \ (fd, how)) -#if _FORTIFY_SOURCE > 0 -#define STUB(fun) __ssp_weak_name(fun) -ssize_t _sys_readlink(const char * __restrict, char * __restrict, size_t); -ssize_t -STUB(readlink)(const char * __restrict path, char * __restrict buf, - size_t bufsiz) -{ - return _sys_readlink(path, buf, bufsiz); -} - -char *_sys_getcwd(char *, size_t); -char * -STUB(getcwd)(char *buf, size_t size) -{ - return _sys_getcwd(buf, size); -} -#else -#define STUB(fun) fun -#endif - FDCALL(ssize_t, REALREAD, DUALCALL_READ, \ (int fd, void *buf, size_t buflen), \ (int, void *, size_t), \