]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
sanitizer/111736 - skip ASAN for globals in alternate address-space
authorRichard Biener <rguenther@suse.de>
Tue, 5 Dec 2023 13:00:43 +0000 (14:00 +0100)
committerRichard Biener <rguenther@suse.de>
Tue, 5 Dec 2023 14:07:49 +0000 (15:07 +0100)
PR sanitizer/111736
* asan.cc (asan_protect_global): Do not protect globals
in non-generic address-space.

gcc/asan.cc

index 2424cf69ef1145e3209c0d5be69d55ad189ac8f2..8d0ffb497cc905c69feedc201ae3105e9d95d990 100644 (file)
@@ -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