Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/include/ssp Allow SSP enabled functions to conditionally ski...
details: https://anonhg.NetBSD.org/src/rev/d42a819676f8
branches: trunk
changeset: 339075:d42a819676f8
user: joerg <joerg%NetBSD.org@localhost>
date: Thu Jun 25 18:41:03 2015 +0000
description:
Allow SSP enabled functions to conditionally skip the object size check.
Use this is fix the getcwd(NULL, lmit) case, which breaks in lang/parrot.
diffstat:
include/ssp/ssp.h | 11 ++++++-----
include/ssp/unistd.h | 5 +++--
2 files changed, 9 insertions(+), 7 deletions(-)
diffs (52 lines):
diff -r 474f59cf220e -r d42a819676f8 include/ssp/ssp.h
--- a/include/ssp/ssp.h Thu Jun 25 16:01:20 2015 +0000
+++ b/include/ssp/ssp.h Thu Jun 25 18:41:03 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ssp.h,v 1.11 2015/05/09 15:41:47 christos Exp $ */
+/* $NetBSD: ssp.h,v 1.12 2015/06/25 18:41:03 joerg Exp $ */
/*-
* Copyright (c) 2006, 2011 The NetBSD Foundation, Inc.
@@ -64,18 +64,19 @@
#define __ssp_check(buf, len, bos) \
if (bos(buf) != (size_t)-1 && len > bos(buf)) \
__chk_fail()
-#define __ssp_redirect_raw(rtype, fun, symbol, args, call, bos) \
+#define __ssp_redirect_raw(rtype, fun, symbol, args, call, cond, bos) \
rtype __ssp_real_(fun) args __RENAME(symbol); \
__ssp_inline rtype fun args __RENAME(__ssp_protected_ ## fun); \
__ssp_inline rtype fun args { \
- __ssp_check(__buf, __len, bos); \
+ if (cond) \
+ __ssp_check(__buf, __len, bos); \
return __ssp_real_(fun) call; \
}
#define __ssp_redirect(rtype, fun, args, call) \
- __ssp_redirect_raw(rtype, fun, fun, args, call, __ssp_bos)
+ __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos)
#define __ssp_redirect0(rtype, fun, args, call) \
- __ssp_redirect_raw(rtype, fun, fun, args, call, __ssp_bos0)
+ __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos0)
#define __ssp_overlap(a, b, l) \
(((a) <= (b) && (b) <= (a) + (l)) || ((b) <= (a) && (a) <= (b) + (l)))
diff -r 474f59cf220e -r d42a819676f8 include/ssp/unistd.h
--- a/include/ssp/unistd.h Thu Jun 25 16:01:20 2015 +0000
+++ b/include/ssp/unistd.h Thu Jun 25 18:41:03 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: unistd.h,v 1.6 2011/01/26 18:07:44 christos Exp $ */
+/* $NetBSD: unistd.h,v 1.7 2015/06/25 18:41:03 joerg Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
@@ -42,7 +42,8 @@
__ssp_redirect(ssize_t, readlink, (const char *__restrict __path, \
char *__restrict __buf, size_t __len), (__path, __buf, __len));
-__ssp_redirect(char *, getcwd, (char *__buf, size_t __len), (__buf, __len));
+__ssp_redirect_raw(char *, getcwd, getcwd, (char *__buf, size_t __len),
+ (__buf, __len), __buf != 0, __ssp_bos);
__END_DECLS
Home |
Main Index |
Thread Index |
Old Index