Disable Fortification for pthread and rump stubs.

This commit is contained in:
joerg 2011-04-21 13:38:14 +00:00
parent 7bda9dcf91
commit 77abb554dc
2 changed files with 10 additions and 62 deletions

View File

@ -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 @@ __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 <sys/msg.h>
#include <sys/types.h>
#include <sys/uio.h>
@ -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)
{

View File

@ -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 @@ 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), \