Module Name: src
Committed By: joerg
Date: Thu Jun 25 18:41:04 UTC 2015
Modified Files:
src/include/ssp: ssp.h unistd.h
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/include/ssp/ssp.h
cvs rdiff -u -r1.6 -r1.7 src/include/ssp/unistd.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/include/ssp/ssp.h
diff -u src/include/ssp/ssp.h:1.11 src/include/ssp/ssp.h:1.12
--- src/include/ssp/ssp.h:1.11 Sat May 9 15:41:47 2015
+++ src/include/ssp/ssp.h Thu Jun 25 18:41:03 2015
@@ -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)))
Index: src/include/ssp/unistd.h
diff -u src/include/ssp/unistd.h:1.6 src/include/ssp/unistd.h:1.7
--- src/include/ssp/unistd.h:1.6 Wed Jan 26 18:07:44 2011
+++ src/include/ssp/unistd.h Thu Jun 25 18:41:03 2015
@@ -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_redirect0(ssize_t, read, (int __fd
__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