From: Richard Biener Date: Tue, 5 Dec 2023 13:00:43 +0000 (+0100) Subject: sanitizer/111736 - skip ASAN for globals in alternate address-space X-Git-Tag: releases/gcc-11.5.0~235 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b86b523fb53f5ffb0e3f3236fc526a587944d9ea;p=thirdparty%2Fgcc.git sanitizer/111736 - skip ASAN for globals in alternate address-space gcc/ChangeLog: PR sanitizer/111736 * asan.c (asan_protect_global): Do not protect globals in non-generic address-space. (cherry picked from commit 7e40497805c0831596334fe474112f991276e11b) --- diff --git a/gcc/asan.c b/gcc/asan.c index 2aa2be13bf66..b92c6007c974 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -2238,6 +2238,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