summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2021-03-23 18:25:22 -0700
committerGeorge Burgess IV <gbiv@google.com>2021-03-29 15:39:50 -0700
commita1112fd8802e204f36b228254a5d71ed14fbc450 (patch)
tree0af8957738985aa8ddd082541c227fc7047f3d69 /libc
parentb40eb10acc747b600ea361726e3212ff81209ab1 (diff)
fortify: mark all always_inline functions with no_stack_protector
FORTIFY'ed functions try to be as close to possible as 'invisible'; having stack protectors detracts from that. Don't apply this to functions which clang has no chance of inlining anyway (like variadic functions) Bug: 182948263 Test: TreeHugger Change-Id: I08cfec25464b8ea1e070942e3dc76fc84da73dd0
Diffstat (limited to 'libc')
-rw-r--r--libc/include/sys/cdefs.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
index b1bd713b5..2556d1183 100644
--- a/libc/include/sys/cdefs.h
+++ b/libc/include/sys/cdefs.h
@@ -281,10 +281,12 @@
*/
# define __call_bypassing_fortify(fn) (&fn)
/*
- * Because clang-FORTIFY uses overloads, we can't mark functions as `extern
- * inline` without making them available externally.
+ * Because clang-FORTIFY uses overloads, we can't mark functions as `extern inline` without making
+ * them available externally. FORTIFY'ed functions try to be as close to possible as 'invisible';
+ * having stack protectors detracts from that (b/182948263).
*/
-# define __BIONIC_FORTIFY_INLINE static __inline__ __always_inline __VERSIONER_FORTIFY_INLINE
+# define __BIONIC_FORTIFY_INLINE static __inline__ __attribute__((no_stack_protector)) \
+ __always_inline __VERSIONER_FORTIFY_INLINE
/*
* We should use __BIONIC_FORTIFY_VARIADIC instead of __BIONIC_FORTIFY_INLINE
* for variadic functions because compilers cannot inline them.