From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100946 invoked by alias); 30 Nov 2017 11:55:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 100919 invoked by uid 89); 30 Nov 2017 11:55:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.7 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KB_WAM_FROM_NAME_SINGLEWORD,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=Hx-languages-length:1865 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 Nov 2017 11:55:01 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DCE24C02738B; Thu, 30 Nov 2017 11:54:59 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-116-77.ams2.redhat.com [10.36.116.77]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7AF665D6A8; Thu, 30 Nov 2017 11:54:59 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id vAUBst3u014103; Thu, 30 Nov 2017 12:54:56 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id vAUBsqQ4014102; Thu, 30 Nov 2017 12:54:52 +0100 Date: Thu, 30 Nov 2017 11:55:00 -0000 From: Jakub Jelinek To: Maxim Ostapenko Cc: GCC Patches , Ramana Radhakrishnan Subject: Re: [Ping][PATCH v3] Fix Incorrect ASan global variables alignment on arm (PR sanitizer/81697) Message-ID: <20171130115452.GF2353@tucnak> Reply-To: Jakub Jelinek References: <5A13E72B.3030906@samsung.com> <5A1D0A93.4080004@samsung.com> <20171129101012.GA2353@tucnak> <5A1FEDB1.9040408@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5A1FEDB1.9040408@samsung.com> User-Agent: Mutt/1.7.1 (2016-10-04) X-IsSubscribed: yes X-SW-Source: 2017-11/txt/msg02553.txt.bz2 On Thu, Nov 30, 2017 at 02:38:25PM +0300, Maxim Ostapenko wrote: > Hi Jakub, thanks for review. > > I've fixed the issues you've pointed in review. > Regarding a testcase -- I've cooked a runtime test, but it shows FP on > unpatched GCC version only when linking with Gold (because it strips > redzones more aggressively). I think we can live with that. > --- a/gcc/varasm.c > +++ b/gcc/varasm.c > @@ -6550,7 +6550,19 @@ categorize_decl_for_section (const_tree decl, int reloc) > ret = reloc == 1 ? SECCAT_DATA_REL_RO_LOCAL : SECCAT_DATA_REL_RO; > else if (reloc || flag_merge_constants < 2 > || ((flag_sanitize & SANITIZE_ADDRESS) > - && asan_protect_global (CONST_CAST_TREE (decl)))) > + /* PR 81697: for architectures that use section anchors we > + need to ignore DECL_RTL_SET_P (decl) for string constants > + inside this asan_protect_global call because otherwise > + we'll wrongly put them into SECCAT_RODATA_MERGE_CONST > + section, set DECL_RTL (decl) later on and add DECL to > + protected globals via successive asan_protect_global > + calls. In this scenario we'll end up with wrong > + alignment of these strings at runtime and possible ASan > + false positives. */ > + && asan_protect_global (CONST_CAST_TREE (decl), > + use_object_blocks_p () > + && use_blocks_for_decl_p ( > + CONST_CAST_TREE (decl))))) Formatting is too bad here. && should go below use_object_block_p.. The opening ( should either go on the next line, like: use_object_blocks_p () && use_blocks_for_decl_p (CONST_CAST_TREE (decl))))) or perhaps better just introduce a temporary somewhere: else if (VAR_P (decl)) { + tree d = CONST_CAST_TREE (decl); if (bss_initializer_p (decl)) ret = SECCAT_BSS; and use d instead of CONST_CAST_TREE (decl) later? Ok with those changes. Jakub