[gcc r14-6184] sanitizer/111736 - skip ASAN for globals in alternate address-space

Richard Biener rguenth@gcc.gnu.org
Tue Dec 5 14:11:58 GMT 2023


https://gcc.gnu.org/g:7e40497805c0831596334fe474112f991276e11b

commit r14-6184-g7e40497805c0831596334fe474112f991276e11b
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Dec 5 14:00:43 2023 +0100

    sanitizer/111736 - skip ASAN for globals in alternate address-space
    
            PR sanitizer/111736
            * asan.cc (asan_protect_global): Do not protect globals
            in non-generic address-space.

Diff:
---
 gcc/asan.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/asan.cc b/gcc/asan.cc
index 2424cf69ef1..8d0ffb497cc 100644
--- a/gcc/asan.cc
+++ b/gcc/asan.cc
@@ -2291,6 +2291,8 @@ asan_protect_global (tree decl, bool ignore_decl_rtl_set_p)
       || (DECL_SECTION_NAME (decl) != NULL
 	  && !symtab_node::get (decl)->implicit_section
 	  && !section_sanitized_p (DECL_SECTION_NAME (decl)))
+      /* Don't protect variables in non-generic address-space.  */
+      || !ADDR_SPACE_GENERIC_P (TYPE_ADDR_SPACE (TREE_TYPE (decl)))
       || DECL_SIZE (decl) == 0
       || ASAN_RED_ZONE_SIZE * BITS_PER_UNIT > MAX_OFILE_ALIGNMENT
       || TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST


More information about the Gcc-cvs mailing list