CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Wed Nov 15 03:14:16 UTC 2023 Modified Files: src/include/ssp: ssp.h Log Message: Allow __ssp_inline to be overriden To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/include/ssp/ssp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Wed Nov 15 03:14:16 UTC 2023 Modified Files: src/include/ssp: ssp.h Log Message: Allow __ssp_inline to be overriden To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/include/ssp/ssp.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.15 src/include/ssp/ssp.h:1.16 --- src/include/ssp/ssp.h:1.15 Fri Nov 10 18:03:37 2023 +++ src/include/ssp/ssp.h Tue Nov 14 22:14:16 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ssp.h,v 1.15 2023/11/10 23:03:37 christos Exp $ */ +/* $NetBSD: ssp.h,v 1.16 2023/11/15 03:14:16 christos Exp $ */ /*- * Copyright (c) 2006, 2011, 2023 The NetBSD Foundation, Inc. @@ -58,8 +58,10 @@ #endif #define __ssp_real(fun) __ssp_real_(fun) +#ifndef __ssp_inline #define __ssp_inline extern __inline \ __attribute__((__always_inline__, __gnu_inline__)) +#endif #if __SSP_FORTIFY_LEVEL > 2 # define __ssp_bos(ptr) __builtin_dynamic_object_size(ptr, 1)
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Fri Nov 10 23:03:37 UTC 2023 Modified Files: src/include/ssp: ssp.h Log Message: PR/57689: RVP: getcwd() not overridable with -D_FORTIFY_SOURCE To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/include/ssp/ssp.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.14 src/include/ssp/ssp.h:1.15 --- src/include/ssp/ssp.h:1.14 Wed Mar 29 09:37:10 2023 +++ src/include/ssp/ssp.h Fri Nov 10 18:03:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: ssp.h,v 1.14 2023/03/29 13:37:10 christos Exp $ */ +/* $NetBSD: ssp.h,v 1.15 2023/11/10 23:03:37 christos Exp $ */ /*- * Copyright (c) 2006, 2011, 2023 The NetBSD Foundation, Inc. @@ -58,7 +58,8 @@ #endif #define __ssp_real(fun) __ssp_real_(fun) -#define __ssp_inline static __inline __attribute__((__always_inline__)) +#define __ssp_inline extern __inline \ +__attribute__((__always_inline__, __gnu_inline__)) #if __SSP_FORTIFY_LEVEL > 2 # define __ssp_bos(ptr) __builtin_dynamic_object_size(ptr, 1)
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Fri Nov 10 23:03:37 UTC 2023 Modified Files: src/include/ssp: ssp.h Log Message: PR/57689: RVP: getcwd() not overridable with -D_FORTIFY_SOURCE To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/include/ssp/ssp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Wed Mar 29 13:37:10 UTC 2023 Modified Files: src/include/ssp: ssp.h Log Message: PR/57288: Mingye Wang: : Use __builtin_dynamic_object_size for LLVM > 9 and GCC > 12, introducing _SSP_FORTIFY_LEVEL == 3 To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/include/ssp/ssp.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.13 src/include/ssp/ssp.h:1.14 --- src/include/ssp/ssp.h:1.13 Thu Sep 3 16:43:47 2015 +++ src/include/ssp/ssp.h Wed Mar 29 09:37:10 2023 @@ -1,7 +1,7 @@ -/* $NetBSD: ssp.h,v 1.13 2015/09/03 20:43:47 plunky Exp $ */ +/* $NetBSD: ssp.h,v 1.14 2023/03/29 13:37:10 christos Exp $ */ /*- - * Copyright (c) 2006, 2011 The NetBSD Foundation, Inc. + * Copyright (c) 2006, 2011, 2023 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -36,7 +36,9 @@ #if !defined(__cplusplus) # if _FORTIFY_SOURCE > 0 && !defined(__lint__) && \ (__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4, 1) -# if _FORTIFY_SOURCE > 1 +# if _FORTIFY_SOURCE > 2 && __has_builtin(__builtin_dynamic_object_size) +# define __SSP_FORTIFY_LEVEL 3 +# elif _FORTIFY_SOURCE > 1 # define __SSP_FORTIFY_LEVEL 2 # else # define __SSP_FORTIFY_LEVEL 1 @@ -58,8 +60,13 @@ #define __ssp_inline static __inline __attribute__((__always_inline__)) -#define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL > 1) -#define __ssp_bos0(ptr) __builtin_object_size(ptr, 0) +#if __SSP_FORTIFY_LEVEL > 2 +# define __ssp_bos(ptr) __builtin_dynamic_object_size(ptr, 1) +# define __ssp_bos0(ptr) __builtin_dynamic_object_size(ptr, 0) +#else +# define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL > 1) +# define __ssp_bos0(ptr) __builtin_object_size(ptr, 0) +#endif #define __ssp_check(buf, len, bos) \ if (bos(buf) != (size_t)-1 && len > bos(buf)) \
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Wed Mar 29 13:37:10 UTC 2023 Modified Files: src/include/ssp: ssp.h Log Message: PR/57288: Mingye Wang: : Use __builtin_dynamic_object_size for LLVM > 9 and GCC > 12, introducing _SSP_FORTIFY_LEVEL == 3 To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/include/ssp/ssp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: plunky Date: Thu Sep 3 20:43:47 UTC 2015 Modified Files: src/include/ssp: ssp.h Log Message: correct __ssp_overlap() to not trigger for adjacent areas To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/include/ssp/ssp.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.12 src/include/ssp/ssp.h:1.13 --- src/include/ssp/ssp.h:1.12 Thu Jun 25 18:41:03 2015 +++ src/include/ssp/ssp.h Thu Sep 3 20:43:47 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ssp.h,v 1.12 2015/06/25 18:41:03 joerg Exp $ */ +/* $NetBSD: ssp.h,v 1.13 2015/09/03 20:43:47 plunky Exp $ */ /*- * Copyright (c) 2006, 2011 The NetBSD Foundation, Inc. @@ -79,7 +79,7 @@ __ssp_inline rtype fun args { \ __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))) +(((a) <= (b) && (b) < (a) + (l)) || ((b) <= (a) && (a) < (b) + (l))) __BEGIN_DECLS void __stack_chk_fail(void) __dead;
CVS commit: src/include/ssp
Module Name:src Committed By: plunky Date: Thu Sep 3 20:43:47 UTC 2015 Modified Files: src/include/ssp: ssp.h Log Message: correct __ssp_overlap() to not trigger for adjacent areas To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/include/ssp/ssp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
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
CVS commit: src/include/ssp
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.
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Sat May 9 15:41:47 UTC 2015 Modified Files: src/include/ssp: ssp.h Log Message: add a macro to check overlapping pointers To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/include/ssp/ssp.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.10 src/include/ssp/ssp.h:1.11 --- src/include/ssp/ssp.h:1.10 Wed Aug 8 16:23:32 2012 +++ src/include/ssp/ssp.h Sat May 9 11:41:47 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ssp.h,v 1.10 2012/08/08 20:23:32 joerg Exp $ */ +/* $NetBSD: ssp.h,v 1.11 2015/05/09 15:41:47 christos Exp $ */ /*- * Copyright (c) 2006, 2011 The NetBSD Foundation, Inc. @@ -77,6 +77,9 @@ __ssp_inline rtype fun args { \ #define __ssp_redirect0(rtype, fun, args, call) \ __ssp_redirect_raw(rtype, fun, fun, args, call, __ssp_bos0) +#define __ssp_overlap(a, b, l) \ +(((a) = (b) (b) = (a) + (l)) || ((b) = (a) (a) = (b) + (l))) + __BEGIN_DECLS void __stack_chk_fail(void) __dead; void __chk_fail(void) __dead;
CVS commit: src/include/ssp
Module Name:src Committed By: pooka Date: Sat Nov 29 13:23:48 UTC 2014 Modified Files: src/include/ssp: string.h Log Message: Create the stpncpy() inline only when GCC=4.8 || clang Mirrors the stpncpy() wrapper macro and avoids the following: warning: implicit declaration of function ‘__builtin___stpncpy_chk’ To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/include/ssp/string.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/string.h diff -u src/include/ssp/string.h:1.12 src/include/ssp/string.h:1.13 --- src/include/ssp/string.h:1.12 Fri Apr 25 18:37:38 2014 +++ src/include/ssp/string.h Sat Nov 29 13:23:48 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.12 2014/04/25 18:37:38 pooka Exp $ */ +/* $NetBSD: string.h,v 1.13 2014/11/29 13:23:48 pooka Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -83,7 +83,9 @@ __ssp_bos_icheck3_restrict(memcpy, void __ssp_bos_icheck3(memmove, void *, const void *) __ssp_bos_icheck3(memset, void *, int) __ssp_bos_icheck2_restrict(stpcpy, char *, const char *) +#if __GNUC_PREREQ__(4,8) || defined(__clang__) __ssp_bos_icheck3_restrict(stpncpy, char *, const char *) +#endif __ssp_bos_icheck2_restrict(strcpy, char *, const char *) __ssp_bos_icheck2_restrict(strcat, char *, const char *) __ssp_bos_icheck3_restrict(strncpy, char *, const char *)
CVS commit: src/include/ssp
Module Name:src Committed By: pooka Date: Sat Nov 29 13:23:48 UTC 2014 Modified Files: src/include/ssp: string.h Log Message: Create the stpncpy() inline only when GCC=4.8 || clang Mirrors the stpncpy() wrapper macro and avoids the following: warning: implicit declaration of function ‘__builtin___stpncpy_chk’ To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/include/ssp/string.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/include/ssp
On Thu, Apr 24, 2014 at 08:12:56PM +, Antti Kantee wrote: Module Name: src Committed By: pooka Date: Thu Apr 24 20:12:56 UTC 2014 Modified Files: src/include/ssp: string.h Log Message: Wrap stpncpy() iff GNUC_PREREQ(4,8). Fixes USE_SSP=yes builds with gcc 4.5. This produces a regerssion for clang users. Joerg
Re: CVS commit: src/include/ssp
In article 20140425171614.ga22...@britannica.bec.de, Joerg Sonnenberger jo...@britannica.bec.de wrote: On Thu, Apr 24, 2014 at 08:12:56PM +, Antti Kantee wrote: Module Name: src Committed By:pooka Date:Thu Apr 24 20:12:56 UTC 2014 Modified Files: src/include/ssp: string.h Log Message: Wrap stpncpy() iff GNUC_PREREQ(4,8). Fixes USE_SSP=yes builds with gcc 4.5. This produces a regerssion for clang users. Yes, what are you trying to fix? christos
Re: CVS commit: src/include/ssp
On 25/04/14 18:00, Christos Zoulas wrote: In article 20140425171614.ga22...@britannica.bec.de, Joerg Sonnenberger jo...@britannica.bec.de wrote: On Thu, Apr 24, 2014 at 08:12:56PM +, Antti Kantee wrote: Module Name:src Committed By: pooka Date: Thu Apr 24 20:12:56 UTC 2014 Modified Files: src/include/ssp: string.h Log Message: Wrap stpncpy() iff GNUC_PREREQ(4,8). Fixes USE_SSP=yes builds with gcc 4.5. This produces a regerssion for clang users. Yes, what are you trying to fix? The thing stated in the commit message: USE_SSP=yes builds with gcc 4.5
CVS commit: src/include/ssp
Module Name:src Committed By: pooka Date: Fri Apr 25 18:37:38 UTC 2014 Modified Files: src/include/ssp: string.h Log Message: Apparently clang pretends to be gcc 4.2 but is secretly much awesomer than gcc 4.2, so enable the stpncpy() wrapper also for clang. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/include/ssp/string.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/string.h diff -u src/include/ssp/string.h:1.11 src/include/ssp/string.h:1.12 --- src/include/ssp/string.h:1.11 Thu Apr 24 20:12:56 2014 +++ src/include/ssp/string.h Fri Apr 25 18:37:38 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.11 2014/04/24 20:12:56 pooka Exp $ */ +/* $NetBSD: string.h,v 1.12 2014/04/25 18:37:38 pooka Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -94,7 +94,7 @@ __END_DECLS #define memmove(dst, src, len) __ssp_bos_check3(memmove, dst, src, len) #define memset(dst, val, len) __ssp_bos_check3(memset, dst, val, len) #define stpcpy(dst, src) __ssp_bos_check2(stpcpy, dst, src) -#if __GNUC_PREREQ__(4,8) +#if __GNUC_PREREQ__(4,8) || defined(__clang__) #define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len) #endif #define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src)
CVS commit: src/include/ssp
Module Name:src Committed By: pooka Date: Fri Apr 25 18:37:38 UTC 2014 Modified Files: src/include/ssp: string.h Log Message: Apparently clang pretends to be gcc 4.2 but is secretly much awesomer than gcc 4.2, so enable the stpncpy() wrapper also for clang. To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/include/ssp/string.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: pooka Date: Thu Apr 24 20:12:56 UTC 2014 Modified Files: src/include/ssp: string.h Log Message: Wrap stpncpy() iff GNUC_PREREQ(4,8). Fixes USE_SSP=yes builds with gcc 4.5. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/include/ssp/string.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Sun Apr 6 19:29:58 UTC 2014 Modified Files: src/include/ssp: string.h Log Message: add stpncpy() To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/include/ssp/string.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/string.h diff -u src/include/ssp/string.h:1.9 src/include/ssp/string.h:1.10 --- src/include/ssp/string.h:1.9 Wed Nov 6 21:00:54 2013 +++ src/include/ssp/string.h Sun Apr 6 15:29:58 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.9 2013/11/07 02:00:54 christos Exp $ */ +/* $NetBSD: string.h,v 1.10 2014/04/06 19:29:58 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -82,6 +82,7 @@ __ssp_bos_icheck3_restrict(memcpy, void __ssp_bos_icheck3(memmove, void *, const void *) __ssp_bos_icheck3(memset, void *, int) __ssp_bos_icheck2_restrict(stpcpy, char *, const char *) +__ssp_bos_icheck3_restrict(stpncpy, char *, const char *) __ssp_bos_icheck2_restrict(strcpy, char *, const char *) __ssp_bos_icheck2_restrict(strcat, char *, const char *) __ssp_bos_icheck3_restrict(strncpy, char *, const char *) @@ -92,6 +93,7 @@ __END_DECLS #define memmove(dst, src, len) __ssp_bos_check3(memmove, dst, src, len) #define memset(dst, val, len) __ssp_bos_check3(memset, dst, val, len) #define stpcpy(dst, src) __ssp_bos_check2(stpcpy, dst, src) +#define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len) #define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src) #define strcat(dst, src) __ssp_bos_check2(strcat, dst, src) #define strncpy(dst, src, len) __ssp_bos_check3(strncpy, dst, src, len)
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Sun Apr 6 19:29:58 UTC 2014 Modified Files: src/include/ssp: string.h Log Message: add stpncpy() To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/include/ssp/string.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Wed Nov 6 16:31:24 UTC 2013 Modified Files: src/include/ssp: string.h Log Message: add stp{,n}cpy To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/include/ssp/string.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/string.h diff -u src/include/ssp/string.h:1.5 src/include/ssp/string.h:1.6 --- src/include/ssp/string.h:1.5 Sun Jul 22 17:05:26 2012 +++ src/include/ssp/string.h Wed Nov 6 11:31:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.5 2012/07/22 21:05:26 joerg Exp $ */ +/* $NetBSD: string.h,v 1.6 2013/11/06 16:31:24 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -37,6 +37,8 @@ __BEGIN_DECLS void *__memcpy_chk(void *, const void *, size_t, size_t); void *__memmove_chk(void *, void *, size_t, size_t); void *__memset_chk(void *, int, size_t, size_t); +char *__stpcpy_chk(char *, const char *, size_t); +char *__stpncpy_chk(char *, const char *, size_t, size_t); char *__strcat_chk(char *, const char *, size_t); char *__strcpy_chk(char *, const char *, size_t); char *__strncat_chk(char *, const char *, size_t, size_t); @@ -89,6 +91,8 @@ __END_DECLS #define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len) #define memmove(dst, src, len) __ssp_bos_check3(memmove, dst, src, len) #define memset(dst, val, len) __ssp_bos_check3(memset, dst, val, len) +#define stpcpy(dst, src) __ssp_bos_check2(stpcpy, dst, src) +#define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len) #define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src) #define strcat(dst, src) __ssp_bos_check2(strcat, dst, src) #define strncpy(dst, src, len) __ssp_bos_check3(strncpy, dst, src, len)
CVS commit: src/include/ssp
Module Name:src Committed By: tron Date: Wed Nov 6 21:33:12 UTC 2013 Modified Files: src/include/ssp: string.h Log Message: Add missing declarations for SSP versions of stpcpy(3) and stpncpy(3). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/include/ssp/string.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/string.h diff -u src/include/ssp/string.h:1.6 src/include/ssp/string.h:1.7 --- src/include/ssp/string.h:1.6 Wed Nov 6 16:31:24 2013 +++ src/include/ssp/string.h Wed Nov 6 21:33:12 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.6 2013/11/06 16:31:24 christos Exp $ */ +/* $NetBSD: string.h,v 1.7 2013/11/06 21:33:12 tron Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -82,6 +82,8 @@ __BEGIN_DECLS __ssp_bos_icheck3_restrict(memcpy, void *, const void *) __ssp_bos_icheck3(memmove, void *, const void *) __ssp_bos_icheck3(memset, void *, int) +__ssp_bos_icheck2_restrict(stpcpy, char *, const char *) +__ssp_bos_icheck3_restrict(stpncpy, char *, const char *) __ssp_bos_icheck2_restrict(strcpy, char *, const char *) __ssp_bos_icheck2_restrict(strcat, char *, const char *) __ssp_bos_icheck3_restrict(strncpy, char *, const char *)
CVS commit: src/include/ssp
Module Name:src Committed By: tron Date: Thu Nov 7 00:02:59 UTC 2013 Modified Files: src/include/ssp: string.h Log Message: Revert my last change. I'm not convinced it is correct and while it seems to fix some build problems it might cause others. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/include/ssp/string.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/string.h diff -u src/include/ssp/string.h:1.7 src/include/ssp/string.h:1.8 --- src/include/ssp/string.h:1.7 Wed Nov 6 21:33:12 2013 +++ src/include/ssp/string.h Thu Nov 7 00:02:58 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.7 2013/11/06 21:33:12 tron Exp $ */ +/* $NetBSD: string.h,v 1.8 2013/11/07 00:02:58 tron Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -82,8 +82,6 @@ __BEGIN_DECLS __ssp_bos_icheck3_restrict(memcpy, void *, const void *) __ssp_bos_icheck3(memmove, void *, const void *) __ssp_bos_icheck3(memset, void *, int) -__ssp_bos_icheck2_restrict(stpcpy, char *, const char *) -__ssp_bos_icheck3_restrict(stpncpy, char *, const char *) __ssp_bos_icheck2_restrict(strcpy, char *, const char *) __ssp_bos_icheck2_restrict(strcat, char *, const char *) __ssp_bos_icheck3_restrict(strncpy, char *, const char *)
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Thu Nov 7 02:00:54 UTC 2013 Modified Files: src/include/ssp: string.h Log Message: gcc-4.8.1 is has a builtin stpncpy, but is missing the __builtin_ ssp equivalent. go figure. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/include/ssp/string.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/string.h diff -u src/include/ssp/string.h:1.8 src/include/ssp/string.h:1.9 --- src/include/ssp/string.h:1.8 Wed Nov 6 19:02:58 2013 +++ src/include/ssp/string.h Wed Nov 6 21:00:54 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.8 2013/11/07 00:02:58 tron Exp $ */ +/* $NetBSD: string.h,v 1.9 2013/11/07 02:00:54 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -38,7 +38,6 @@ void *__memcpy_chk(void *, const void *, void *__memmove_chk(void *, void *, size_t, size_t); void *__memset_chk(void *, int, size_t, size_t); char *__stpcpy_chk(char *, const char *, size_t); -char *__stpncpy_chk(char *, const char *, size_t, size_t); char *__strcat_chk(char *, const char *, size_t); char *__strcpy_chk(char *, const char *, size_t); char *__strncat_chk(char *, const char *, size_t, size_t); @@ -82,6 +81,7 @@ __BEGIN_DECLS __ssp_bos_icheck3_restrict(memcpy, void *, const void *) __ssp_bos_icheck3(memmove, void *, const void *) __ssp_bos_icheck3(memset, void *, int) +__ssp_bos_icheck2_restrict(stpcpy, char *, const char *) __ssp_bos_icheck2_restrict(strcpy, char *, const char *) __ssp_bos_icheck2_restrict(strcat, char *, const char *) __ssp_bos_icheck3_restrict(strncpy, char *, const char *) @@ -92,7 +92,6 @@ __END_DECLS #define memmove(dst, src, len) __ssp_bos_check3(memmove, dst, src, len) #define memset(dst, val, len) __ssp_bos_check3(memset, dst, val, len) #define stpcpy(dst, src) __ssp_bos_check2(stpcpy, dst, src) -#define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len) #define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src) #define strcat(dst, src) __ssp_bos_check2(strcat, dst, src) #define strncpy(dst, src, len) __ssp_bos_check3(strncpy, dst, src, len)
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Wed Nov 6 16:31:24 UTC 2013 Modified Files: src/include/ssp: string.h Log Message: add stp{,n}cpy To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/include/ssp/string.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: tron Date: Wed Nov 6 21:33:12 UTC 2013 Modified Files: src/include/ssp: string.h Log Message: Add missing declarations for SSP versions of stpcpy(3) and stpncpy(3). To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/include/ssp/string.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Thu Nov 7 02:00:54 UTC 2013 Modified Files: src/include/ssp: string.h Log Message: gcc-4.8.1 is has a builtin stpncpy, but is missing the __builtin_ ssp equivalent. go figure. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/include/ssp/string.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: joerg Date: Wed Aug 8 20:23:33 UTC 2012 Modified Files: src/include/ssp: ssp.h Log Message: SSP mostly works with Clang, even if optimisation is disabled. Explicitly disable it for Lint though. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/include/ssp/ssp.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.9 src/include/ssp/ssp.h:1.10 --- src/include/ssp/ssp.h:1.9 Mon Feb 21 00:40:08 2011 +++ src/include/ssp/ssp.h Wed Aug 8 20:23:32 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: ssp.h,v 1.9 2011/02/21 00:40:08 joerg Exp $ */ +/* $NetBSD: ssp.h,v 1.10 2012/08/08 20:23:32 joerg Exp $ */ /*- * Copyright (c) 2006, 2011 The NetBSD Foundation, Inc. @@ -34,7 +34,8 @@ #include sys/cdefs.h #if !defined(__cplusplus) -# if _FORTIFY_SOURCE 0 __OPTIMIZE__ 0 __GNUC_PREREQ__(4, 1) +# if _FORTIFY_SOURCE 0 !defined(__lint__) \ + (__OPTIMIZE__ 0 || defined(__clang__)) __GNUC_PREREQ__(4, 1) # if _FORTIFY_SOURCE 1 # define __SSP_FORTIFY_LEVEL 2 # else
CVS commit: src/include/ssp
Module Name:src Committed By: joerg Date: Wed Aug 8 20:23:33 UTC 2012 Modified Files: src/include/ssp: ssp.h Log Message: SSP mostly works with Clang, even if optimisation is disabled. Explicitly disable it for Lint though. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/include/ssp/ssp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: joerg Date: Sun Jul 22 21:05:26 UTC 2012 Modified Files: src/include/ssp: string.h Log Message: Always provide *_chk prototypes. Fixes DBG=-g build of libc. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/include/ssp/string.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/string.h diff -u src/include/ssp/string.h:1.4 src/include/ssp/string.h:1.5 --- src/include/ssp/string.h:1.4 Tue Nov 17 20:47:59 2009 +++ src/include/ssp/string.h Sun Jul 22 21:05:26 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: string.h,v 1.4 2009/11/17 20:47:59 drochner Exp $ */ +/* $NetBSD: string.h,v 1.5 2012/07/22 21:05:26 joerg Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -33,6 +33,16 @@ #include ssp/ssp.h +__BEGIN_DECLS +void *__memcpy_chk(void *, const void *, size_t, size_t); +void *__memmove_chk(void *, void *, size_t, size_t); +void *__memset_chk(void *, int, size_t, size_t); +char *__strcat_chk(char *, const char *, size_t); +char *__strcpy_chk(char *, const char *, size_t); +char *__strncat_chk(char *, const char *, size_t, size_t); +char *__strncpy_chk(char *, const char *, size_t, size_t); +__END_DECLS + #if __SSP_FORTIFY_LEVEL 0 #define __ssp_bos_check3(fun, dst, src, len) \ @@ -74,13 +84,6 @@ __ssp_bos_icheck2_restrict(strcpy, char __ssp_bos_icheck2_restrict(strcat, char *, const char *) __ssp_bos_icheck3_restrict(strncpy, char *, const char *) __ssp_bos_icheck3_restrict(strncat, char *, const char *) -void *__memcpy_chk(void *, const void *, size_t, size_t); -void *__memmove_chk(void *, void *, size_t, size_t); -void *__memset_chk(void *, int, size_t, size_t); -char *__strcat_chk(char *, const char *, size_t); -char *__strcpy_chk(char *, const char *, size_t); -char *__strncat_chk(char *, const char *, size_t, size_t); -char *__strncpy_chk(char *, const char *, size_t, size_t); __END_DECLS #define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len)
CVS commit: src/include/ssp
Module Name:src Committed By: joerg Date: Sun Jul 22 21:05:26 UTC 2012 Modified Files: src/include/ssp: string.h Log Message: Always provide *_chk prototypes. Fixes DBG=-g build of libc. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/include/ssp/string.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Wed Jan 26 18:07:44 UTC 2011 Modified Files: src/include/ssp: unistd.h Log Message: fix readlink prototype. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 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/unistd.h diff -u src/include/ssp/unistd.h:1.5 src/include/ssp/unistd.h:1.6 --- src/include/ssp/unistd.h:1.5 Wed Jan 19 14:21:29 2011 +++ src/include/ssp/unistd.h Wed Jan 26 13:07:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: unistd.h,v 1.5 2011/01/19 19:21:29 christos Exp $ */ +/* $NetBSD: unistd.h,v 1.6 2011/01/26 18:07:44 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ __ssp_redirect0(ssize_t, read, (int __fd, void *__buf, size_t __len), \ (__fd, __buf, __len)); -__ssp_redirect(int, readlink, (const char *__restrict __path, \ +__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));
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Wed Jan 26 18:08:00 UTC 2011 Modified Files: src/include/ssp: ssp.h Log Message: provide a way to override the weak name. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/include/ssp/ssp.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.7 src/include/ssp/ssp.h:1.8 --- src/include/ssp/ssp.h:1.7 Tue Jan 25 14:13:44 2011 +++ src/include/ssp/ssp.h Wed Jan 26 13:08:00 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ssp.h,v 1.7 2011/01/25 19:13:44 christos Exp $ */ +/* $NetBSD: ssp.h,v 1.8 2011/01/26 18:08:00 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -43,11 +43,13 @@ # endif #endif +#ifndef __ssp_weak_name #ifdef _NAMESPACE_H_ #define __ssp_weak_name(fun) _sys ## fun #else #define __ssp_weak_name(fun) _sys_ ## fun #endif +#endif #define __ssp_inline static __inline __attribute__((__always_inline__))
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Wed Jan 26 18:07:44 UTC 2011 Modified Files: src/include/ssp: unistd.h Log Message: fix readlink prototype. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/include/ssp/unistd.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Wed Jan 26 18:08:00 UTC 2011 Modified Files: src/include/ssp: ssp.h Log Message: provide a way to override the weak name. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/include/ssp/ssp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Tue Jan 25 19:13:45 UTC 2011 Modified Files: src/include/ssp: ssp.h Log Message: proved an __ssp_check macro. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/include/ssp/ssp.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.6 src/include/ssp/ssp.h:1.7 --- src/include/ssp/ssp.h:1.6 Wed Jan 19 21:58:17 2011 +++ src/include/ssp/ssp.h Tue Jan 25 14:13:44 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ssp.h,v 1.6 2011/01/20 02:58:17 christos Exp $ */ +/* $NetBSD: ssp.h,v 1.7 2011/01/25 19:13:44 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -54,12 +54,14 @@ #define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL 1) #define __ssp_bos0(ptr) __builtin_object_size(ptr, 0) +#define __ssp_check(buf, len, bos) \ + if (bos(buf) != (size_t)-1 len bos(buf)) \ + __chk_fail() #define __ssp_redirect_raw(rtype, fun, args, call, bos) \ rtype __ssp_weak_name(fun) args; \ __ssp_inline rtype fun args; \ __ssp_inline rtype fun args { \ - if (bos(__buf) != (size_t)-1 __len bos(__buf)) \ - __chk_fail(); \ + __ssp_check(__buf, __len, bos); \ return __ssp_weak_name(fun) call; \ }
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Tue Jan 25 19:13:45 UTC 2011 Modified Files: src/include/ssp: ssp.h Log Message: proved an __ssp_check macro. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/include/ssp/ssp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Thu Jan 20 02:58:17 UTC 2011 Modified Files: src/include/ssp: ssp.h Log Message: Use the _sys alias instead of the _ alias as the way to access the baseline syscall. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/include/ssp/ssp.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.5 src/include/ssp/ssp.h:1.6 --- src/include/ssp/ssp.h:1.5 Wed Jan 19 14:21:29 2011 +++ src/include/ssp/ssp.h Wed Jan 19 21:58:17 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: ssp.h,v 1.5 2011/01/19 19:21:29 christos Exp $ */ +/* $NetBSD: ssp.h,v 1.6 2011/01/20 02:58:17 christos Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -43,7 +43,12 @@ # endif #endif -#define __ssp_weak_name(fun) _ ## fun +#ifdef _NAMESPACE_H_ +#define __ssp_weak_name(fun) _sys ## fun +#else +#define __ssp_weak_name(fun) _sys_ ## fun +#endif + #define __ssp_inline static __inline __attribute__((__always_inline__)) #define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL 1)
CVS commit: src/include/ssp
Module Name:src Committed By: christos Date: Thu Jan 20 02:58:17 UTC 2011 Modified Files: src/include/ssp: ssp.h Log Message: Use the _sys alias instead of the _ alias as the way to access the baseline syscall. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/include/ssp/ssp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/include/ssp
Module Name:src Committed By: jruoho Date: Wed Dec 22 19:43:33 UTC 2010 Modified Files: src/include/ssp: ssp.h Log Message: Use __dead instead of __attribute__((__noreturn__)) directly. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/include/ssp/ssp.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.3 src/include/ssp/ssp.h:1.4 --- src/include/ssp/ssp.h:1.3 Mon Apr 28 20:22:54 2008 +++ src/include/ssp/ssp.h Wed Dec 22 19:43:33 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: ssp.h,v 1.3 2008/04/28 20:22:54 martin Exp $ */ +/* $NetBSD: ssp.h,v 1.4 2010/12/22 19:43:33 jruoho Exp $ */ /*- * Copyright (c) 2006 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ if (bos(__buf) != (size_t)-1 __len bos(__buf)) \ __chk_fail(); \ return fun call; \ -} +} #define __ssp_redirect(rtype, fun, args, call) \ __ssp_redirect_raw(rtype, fun, args, call, __ssp_bos) @@ -66,8 +66,8 @@ __ssp_redirect_raw(rtype, fun, args, call, __ssp_bos0) __BEGIN_DECLS -void __stack_chk_fail(void) __attribute__((__noreturn__)); -void __chk_fail(void) __attribute__((__noreturn__)); +void __stack_chk_fail(void) __dead; +void __chk_fail(void) __dead; __END_DECLS #endif /* _SSP_SSP_H_ */