From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74249 invoked by alias); 2 Mar 2015 12:25:45 -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 74240 invoked by uid 89); 2 Mar 2015 12:25:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL,BAYES_50,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-lb0-f178.google.com Received: from mail-lb0-f178.google.com (HELO mail-lb0-f178.google.com) (209.85.217.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 02 Mar 2015 12:25:43 +0000 Received: by lbiz12 with SMTP id z12so1672461lbi.12 for ; Mon, 02 Mar 2015 04:25:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=JHL6Jz2cT1ujtGV83FxAo5grhhQk1dyiLCZ5UmH55t8=; b=X6DRvdK4pcf8ZmXo/jaNYAeQuHmhZPNYFgslLXfu8S6dc+ou6ZSQHdf1mJuQ8cOWI4 w9UeLwZjjenxAYws550FVy85T1rgjrM1+PW/5k9TavGVkIacUSi8gnr1EfSnj1CvvQBd syP0mdlcALPCXEJHs75oP1GP1ylq1q81+FBt9w7nvRe+iJx5iiw1/lJj1G6yyuWDdKdR RwtwmHISInPaT9MqhPMP3jU7H0FUgidqeRU2BtIfAIzsivWLQx6qhHmbp+Za1wKWY7nK AXXg+nz/7Zl3AbRacal9lBZDxsJ9lPRy3gRbWvRZC8sRoecP/MtLVb92W7SYS6YTxwx6 MJ5Q== X-Gm-Message-State: ALoCoQmMUrVQdaQVaEZzcNr4FPWYLo+QOjRkLW1BCIQWPpJeRolCpk5XcmKHpwgVIb3AG3ZnWVs8 X-Received: by 10.152.10.66 with SMTP id g2mr23919113lab.44.1425299140456; Mon, 02 Mar 2015 04:25:40 -0800 (PST) Received: from [192.168.1.64] (ppp91-76-180-33.pppoe.mtu-net.ru. [91.76.180.33]) by mx.google.com with ESMTPSA id jr1sm2512070lbc.12.2015.03.02.04.25.39 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Mar 2015 04:25:39 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: [PATCH, CHKP, PR target/65183] Avoid wrong pass local data usage From: Maxim Kuvyrkov In-Reply-To: Date: Mon, 02 Mar 2015 12:25:00 -0000 Cc: gcc-patches Content-Transfer-Encoding: quoted-printable Message-Id: References: <20150225091930.GA65329@msticlxl57.ims.intel.com> To: Ilya Enkovich X-SW-Source: 2015-03/txt/msg00054.txt.bz2 > On Mar 2, 2015, at 1:41 PM, Ilya Enkovich wrote: >=20 > Committed to trunk. Hi Ilya, Was this approved offline? If so, it is a good habit to note in the "Commi= tted to trunk" message who approved it. This way we have reviewer's name o= n file. Thank you, -- Maxim Kuvyrkov www.linaro.org >=20 > 2015-02-25 12:19 GMT+03:00 Ilya Enkovich : >> Hi, >>=20 >> This patch fixes a case when outdated checker local data is used to proc= ess external calls. Bootstrapped and tested on x86_64-unknown-linux-gnu. = OK for trunk? >>=20 >> Thanks, >> Ilya >> -- >> gcc/ >>=20 >> 2015-02-25 Ilya Enkovich >>=20 >> PR target/65183 >> * tree-chkp.c (chkp_check_lower): Don't check against >> zero bounds for already instrumented functions. >> (chkp_check_upper): Likewise. >> (chkp_fini): Clean pass local data to avoid wrong reusage. >>=20 >> gcc/testsuite/ >>=20 >> 2015-02-25 Ilya Enkovich >>=20 >> PR target/65183 >> * gcc.target/i386/pr65183.c: New. >>=20 >>=20 >> diff --git a/gcc/testsuite/gcc.target/i386/pr65183.c b/gcc/testsuite/gcc= .target/i386/pr65183.c >> new file mode 100644 >> index 0000000..069a543 >> --- /dev/null >> +++ b/gcc/testsuite/gcc.target/i386/pr65183.c >> @@ -0,0 +1,20 @@ >> +/* { dg-do compile } */ >> +/* { dg-require-effective-target mpx } */ >> +/* { dg-options "-O -fcheck-pointer-bounds -fchkp-use-nochk-string-func= tions -mmpx" } */ >> + >> +extern void bar(void *); >> +extern void baz(void); >> + >> +static int lc[32]; >> + >> +void foobar(void *c) >> +{ >> + bar(&c); >> + __builtin_memcpy (lc, c, lc[0]); >> +} >> + >> +void foo () >> +{ >> + baz (); >> + foobar(0); >> +} >> diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c >> index b0a3a15..d2df4ba 100644 >> --- a/gcc/tree-chkp.c >> +++ b/gcc/tree-chkp.c >> @@ -1268,7 +1268,8 @@ chkp_check_lower (tree addr, tree bounds, >> gimple check; >> tree node; >>=20 >> - if (bounds =3D=3D chkp_get_zero_bounds ()) >> + if (!chkp_function_instrumented_p (current_function_decl) >> + && bounds =3D=3D chkp_get_zero_bounds ()) >> return; >>=20 >> if (dirflag =3D=3D integer_zero_node >> @@ -1314,7 +1315,8 @@ chkp_check_upper (tree addr, tree bounds, >> gimple check; >> tree node; >>=20 >> - if (bounds =3D=3D chkp_get_zero_bounds ()) >> + if (!chkp_function_instrumented_p (current_function_decl) >> + && bounds =3D=3D chkp_get_zero_bounds ()) >> return; >>=20 >> if (dirflag =3D=3D integer_zero_node >> @@ -4306,6 +4308,10 @@ chkp_fini (void) >> free_dominance_info (CDI_POST_DOMINATORS); >>=20 >> bitmap_obstack_release (NULL); >> + >> + entry_block =3D NULL; >> + zero_bounds =3D NULL_TREE; >> + none_bounds =3D NULL_TREE; >> } >>=20 >> /* Main instrumentation pass function. */