aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2023-12-05 14:00:43 +0100
committerRichard Biener <rguenther@suse.de>2023-12-05 15:07:49 +0100
commit7e40497805c0831596334fe474112f991276e11b (patch)
tree5701a077e91916f3138609fb32899e3b15fefe32 /gcc
parent1e6c4aa47972d6b56225e7776f3cf41f2cc01da2 (diff)
downloadgcc-7e40497805c0831596334fe474112f991276e11b.zip
gcc-7e40497805c0831596334fe474112f991276e11b.tar.gz
gcc-7e40497805c0831596334fe474112f991276e11b.tar.bz2
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/asan.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/asan.cc b/gcc/asan.cc
index 2424cf6..8d0ffb4 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