]> 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)
committerUros Bizjak <ubizjak@gmail.com>
Tue, 23 Apr 2024 14:24:57 +0000 (16:24 +0200)
PR sanitizer/111736
* asan.cc (asan_protect_global): Do not protect globals
in non-generic address-space.

(cherry picked from commit 7e40497805c0831596334fe474112f991276e11b)

gcc/asan.cc

index 72d1ef28be86315ec33b1af71481f5c1f084efd7..0c5afa36cb85a2cd29b48f9c0ab58fcb3b0dbfa7 100644 (file)
@@ -2251,6 +2251,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