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
This commit is contained in:
George Burgess IV 2021-03-23 18:25:22 -07:00
parent b40eb10acc
commit a1112fd880

View file

@ -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.