From patchwork Thu Oct 25 22:48:07 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wei Mi X-Patchwork-Id: 194320 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id F0B8D2C00A4 for ; Fri, 26 Oct 2012 09:48:22 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1351810104; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type: Content-Transfer-Encoding:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=FszVHZbkvrBCdWTLpFJRcCjASDw=; b=J9R4XmAI+l5e6iF 90oZH9Iw7zqgBnu5uzBuABx7VxVBoWp+Lwsn4gwxpiuNmdYk0LJ+4HW8W6IJbJH0 trQy76v4fjD1YT+cOP6/9dwgC9tywZ84ZdaGo3iD/3nxZxAExT5itkeRRRxJMSWu 13Q3rD43f1vd521iHnBliPvzjRZ4= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:Content-Transfer-Encoding:X-System-Of-Record:X-Gm-Message-State:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=XYPcp0cNNoU0l+6qBwkrmmb01dH1Bnfg8Cei19ru5DWIa7GoEG6zx4mlTBdTrs HiDlRCaPM2NNYHcmynq6TkE83twBZfezRTaqGAaTSzy8Y8KZfPN6os0txis62YB3 uZuvtkI6J7MxWGRCJTPlpWBtIf5E5uC2K1iDjMm9Bh630=; Received: (qmail 11931 invoked by alias); 25 Oct 2012 22:48:15 -0000 Received: (qmail 11902 invoked by uid 22791); 25 Oct 2012 22:48:13 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-qa0-f54.google.com (HELO mail-qa0-f54.google.com) (209.85.216.54) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 25 Oct 2012 22:48:08 +0000 Received: by mail-qa0-f54.google.com with SMTP id p27so20399qat.20 for ; Thu, 25 Oct 2012 15:48:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding:x-system-of-record :x-gm-message-state; bh=H1mmGGv2pLFmSqPhZmN+lgYwf4/NWhNAtATC9+ce/5k=; b=LBG7VC88qClyYl3xHstRlt68yqD3iR2STZu0rajwIET0mXYrKNnLBcQbIqsXH2Iq+e zdN7b+W1wosKEVzgL1ZmZ/aSUa3Yo44xZ/dAnerYbnTNwUE7oyp/o/p9UOOlZ5tKoBt1 2RfR3CNCrarBTuBApj1uPnyjJJEL6xmF5zFMzvgalcfvo6H2312YLeor66xkJl//RSpZ l8tB5MGAtuYszhL2aBO6UfJou1cLi/irg/J1QyVzZ/0gxw3LFF3B2PD7H3zBUUm7PTqH ChOO1oXNqES9AkXoJpnn2s2ZmlTCEll4oQ6uwFa30cXzHHyZbcYKqnPEIAGUSXdvOyRG EeAw== MIME-Version: 1.0 Received: by 10.224.42.15 with SMTP id q15mr9700074qae.68.1351205287500; Thu, 25 Oct 2012 15:48:07 -0700 (PDT) Received: by 10.49.87.164 with HTTP; Thu, 25 Oct 2012 15:48:07 -0700 (PDT) In-Reply-To: <20121025214656.GQ1752@tucnak.redhat.com> References: <20121025214656.GQ1752@tucnak.redhat.com> Date: Thu, 25 Oct 2012 15:48:07 -0700 Message-ID: Subject: Re: [asan] a small patch to fix bogus error about global buffer overflow From: Wei Mi To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org, Diego Novillo , David Li , Dodji Seketeli , Andrew Pinski X-System-Of-Record: true X-Gm-Message-State: ALoCoQkw01fGvf15gP/ta2qs0Oxgt3QgHdaFuQJBwgLu22mY+7fLK+9mcc2ZHjyNHAmIbW9dvkTFJDATvGuM5s5Sm5BPE70J2Or7NQEybuTbgZJ4VVlDAhNbIeiZl2K6cwsI/8VCWYvMt2ZJTT4Utc3yvvxwri9rkqWyLmlP9+ATxHUDkkBPYIb3qlnzRgLGYQ+9CuGsZora Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, Thanks for all the comments. Fixed. Ok to checkin? 2012-10-25 Wei Mi   * varasm.c (assemble_variable): Set asan_protected even for decls that are already ASAN_RED_ZONE_SIZE or more bytes aligned. On Thu, Oct 25, 2012 at 2:46 PM, Jakub Jelinek wrote: > On Thu, Oct 25, 2012 at 02:32:33PM -0700, Wei Mi wrote: >> A small patch to remove the bogus error reports exposed in the >> spec2000 testing. In varasm.c, asan_protected should be equivalent >> with asan_protect_global (decl) all the time, or else compiler will >> not insert redzones for some globals planned to be protected. >> >> gcc/ChangeLog: >> 2012-10-25 Wei Mi >> >> A small fix to remove bogus error report of global buffer overflow. >> * varasm.c: correct the condition of asan_protected being true. > > The patch is almost ok, the ChangeLog entry is not. > Two instead of 3 spaces between date and name, no need for introductory > comment above * varasm.c line, name of modified function and capital > letter after :. > Perhaps > * varasm.c (assemble_variable): Set asan_protected even for decls > that are already ASAN_RED_ZONE_SIZE or more bytes aligned. > > Ok with that Change and: > >> --- varasm.c (revision 192822) >> +++ varasm.c (working copy) >> @@ -1991,11 +1991,10 @@ assemble_variable (tree decl, int top_le >> align_variable (decl, dont_output_data); >> >> if (flag_asan >> - && asan_protect_global (decl) >> - && DECL_ALIGN (decl) < ASAN_RED_ZONE_SIZE * BITS_PER_UNIT) >> + && asan_protect_global (decl)) >> { >> asan_protected = true; >> - DECL_ALIGN (decl) = ASAN_RED_ZONE_SIZE * BITS_PER_UNIT; >> + DECL_ALIGN (decl) = MAX (DECL_ALIGN (decl), ASAN_RED_ZONE_SIZE > * BITS_PER_UNIT); > > Too long line, put ASAN_RED_ZONE_SIZE * BITS_PER_UNIT on next > line below the second DECL_ALIGN (decl). > > Jakub Index: varasm.c =================================================================== --- varasm.c (revision 192822) +++ varasm.c (working copy) @@ -1991,11 +1991,11 @@ assemble_variable (tree decl, int top_le align_variable (decl, dont_output_data); if (flag_asan - && asan_protect_global (decl) - && DECL_ALIGN (decl) < ASAN_RED_ZONE_SIZE * BITS_PER_UNIT) + && asan_protect_global (decl)) { asan_protected = true; - DECL_ALIGN (decl) = ASAN_RED_ZONE_SIZE * BITS_PER_UNIT; + DECL_ALIGN (decl) = MAX (DECL_ALIGN (decl), + ASAN_RED_ZONE_SIZE * BITS_PER_UNIT); } set_mem_align (decl_rtl, DECL_ALIGN (decl));