Skip to content

Commit

Permalink
13.1.0: don't set _FORTIFY_SOURCE if -fsanitize=address (ASAN) is ena…
Browse files Browse the repository at this point in the history
…bled

This can cause either false positives in warnings from the compiler or false
negatives where the sanitizer misses something.

Bug: google/sanitizers#247
Signed-off-by: Sam James <sam@gentoo.org>
  • Loading branch information
thesamesam committed Mar 13, 2023
1 parent 27495bc commit b37b9b3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 13.1.0/gentoo/01_all_default-fortify-source.patch
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ initially Gentoo used too complicated macro.
+ #define GENTOO_FORTIFY_SOURCE_LEVEL 2
+ #endif
+
+ /* Fortify Source enabled by default for optimization levels > 0 */
+ if (optimize)
+ /* F_S enabled by default for optimization levels > 0, except for ASAN: https://github.com/google/sanitizers/issues/247 */
+ if (optimize && ! (flag_sanitize & SANITIZE_ADDRESS))
+ builtin_define_with_int_value ("_FORTIFY_SOURCE", GENTOO_FORTIFY_SOURCE_LEVEL);
+#endif
+
Expand Down
3 changes: 3 additions & 0 deletions 13.1.0/gentoo/README.history
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
9 13 Mar 2023
U 01_all_default-fortify-source.patch

8 12 Feb 2023
- 76_all_all_PR107461_cxx_equivalence_non_dependent_calls.patch

Expand Down

0 comments on commit b37b9b3

Please sign in to comment.