From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 114374 invoked by alias); 24 Mar 2015 14:06:27 -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 114363 invoked by uid 89); 24 Mar 2015 14:06:26 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 24 Mar 2015 14:06:26 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2OE6Nlf020008 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 24 Mar 2015 10:06:24 -0400 Received: from tucnak.zalov.cz (ovpn-116-58.ams2.redhat.com [10.36.116.58]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2OE6LSA025746 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 24 Mar 2015 10:06:23 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id t2OE6KR2010102; Tue, 24 Mar 2015 15:06:20 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id t2OE6J6x009911; Tue, 24 Mar 2015 15:06:19 +0100 Date: Tue, 24 Mar 2015 14:06:00 -0000 From: Jakub Jelinek To: Ilya Enkovich Cc: gcc-patches Subject: Re: [CHKP, PATCH] Fix instrumented indirect calls with propagated pointers Message-ID: <20150324140619.GE1746@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20150312100931.GK27860@msticlxl57.ims.intel.com> <20150319082944.GC64546@msticlxl57.ims.intel.com> <20150324083325.GC1746@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg01248.txt.bz2 On Tue, Mar 24, 2015 at 12:22:27PM +0300, Ilya Enkovich wrote: > 2015-03-24 11:33 GMT+03:00 Jakub Jelinek : > > On Thu, Mar 19, 2015 at 11:29:44AM +0300, Ilya Enkovich wrote: > >> + /* We might propagate instrumented function pointer into > >> + not instrumented function and vice versa. In such a > >> + case we need to either fix function declaration or > >> + remove bounds from call statement. */ > >> + if (callee) > >> + skip_bounds = chkp_redirect_edge (e); > > > > I just want to say that I'm not really excited about all this compile time > > cost that is added everywhere unconditionally for chkp. > > I think much better would be to guard most of it with proper option check > > first and only do the more expensive part if the option has been used. > > Agree, overhead for not instrumented code should be minimized. > Unfortunately there is no option check I can use to guard chkp codes > due to LTO. Currently it is allowed to pass -fcheck-pointer-bounds for > IL generation and don't pass it for final code generation. I suppose I > may set this (or some new) flag if see instrumented node when read > cgraph and then use it to guard chkp related codes. Would it be > acceptable? The question is what you want to do in the LTO case for the different cases, in particular a TU compiled with -fcheck-pointer-bounds and LTO link without that, or TU compiled without -fcheck-pointer-bounds and LTO link with it. It could be handled as LTO incompatible option, where lto1 would error out if you try to mix -fcheck-pointer-bounds with -fno-check-pointer-bounds code, or e.g. similar to var-tracking, you could consider adjusting the IL upon LTO reading if if some TU has been built with -fcheck-pointer-bounds and the LTO link is -fno-check-pointer-bounds. Dunno what will happen with -fno-check-pointer-bounds TUs LTO linked with -fcheck-pointer-bounds. Or another possibility is to or in -fcheck-pointer-bounds from all TUs. > Maybe replace attribute usage with a new flag in tree_decl_with_vis structure? Depends, might be better to stick it into cgraph_node instead, depends on whether you are querying it already early in the FEs or just during GIMPLE when the cgraph node should be created too. Jakub