Module Name: src Committed By: joerg Date: Thu Apr 21 13:38:14 UTC 2011
Modified Files: src/lib/libpthread: pthread_cancelstub.c src/lib/librumphijack: hijack.c Log Message: Disable Fortification for pthread and rump stubs. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/lib/libpthread/pthread_cancelstub.c cvs rdiff -u -r1.89 -r1.90 src/lib/librumphijack/hijack.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libpthread/pthread_cancelstub.c diff -u src/lib/libpthread/pthread_cancelstub.c:1.33 src/lib/libpthread/pthread_cancelstub.c:1.34 --- src/lib/libpthread/pthread_cancelstub.c:1.33 Thu Apr 21 08:17:00 2011 +++ src/lib/libpthread/pthread_cancelstub.c Thu Apr 21 13:38:14 2011 @@ -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 <sys/cdefs.h> -__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 @@ */ #define __LIBC12_SOURCE__ -#define __ssp_weak_name(fun) _cancelstub_ ## fun - #include <sys/msg.h> #include <sys/types.h> #include <sys/uio.h> @@ -470,40 +471,6 @@ 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) { Index: src/lib/librumphijack/hijack.c diff -u src/lib/librumphijack/hijack.c:1.89 src/lib/librumphijack/hijack.c:1.90 --- src/lib/librumphijack/hijack.c:1.89 Thu Apr 21 08:21:13 2011 +++ src/lib/librumphijack/hijack.c Thu Apr 21 13:38:14 2011 @@ -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 <sys/cdefs.h> -__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 <sys/cdefs.h> +__RCSID("$NetBSD: hijack.c,v 1.90 2011/04/21 13:38:14 joerg Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -1970,26 +1971,6 @@ (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), \