From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29724 invoked by alias); 15 May 2014 11:07:26 -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 29706 invoked by uid 89); 15 May 2014 11:07:25 -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_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f173.google.com Received: from mail-ie0-f173.google.com (HELO mail-ie0-f173.google.com) (209.85.223.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 15 May 2014 11:07:24 +0000 Received: by mail-ie0-f173.google.com with SMTP id rp18so840284iec.18 for ; Thu, 15 May 2014 04:07:22 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.50.79.161 with SMTP id k1mr11574196igx.31.1400152042502; Thu, 15 May 2014 04:07:22 -0700 (PDT) Received: by 10.64.102.165 with HTTP; Thu, 15 May 2014 04:07:22 -0700 (PDT) In-Reply-To: References: <53713B09.9080501@redhat.com> <537270B6.1080103@redhat.com> Date: Thu, 15 May 2014 11:07:00 -0000 Message-ID: Subject: Re: [RFC] Using function clones for Pointer Bounds Checker From: Ilya Enkovich To: "H.J. Lu" Cc: Jeff Law , gcc-patches , Richard Biener , "Zamyatin, Igor" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg01177.txt.bz2 2014-05-14 19:09 GMT+04:00 H.J. Lu : > On Wed, May 14, 2014 at 1:18 AM, Ilya Enkovich wrote: >> 2014-05-13 23:21 GMT+04:00 Jeff Law : >>> On 05/13/14 02:38, Ilya Enkovich wrote: >>>>>> >>>>>> propagate constant bounds value and remove checks in called function). >>>>> >>>>> >>>>> So from a linking standpoint, presumably you have to mangle the >>>>> instrumented >>>>> caller/callee in some manner. Right? Or are you dynamically dispatching >>>>> somehow? >>>> >>>> >>>> Originally the idea was o have instrumented clone to have the same >>>> assembler name as the original function. Since instrumented code is >>>> fully compatible with not instrumented code, we always emit only one >>>> version. Usage of the same assembler name allows instrumented and not >>>> instrumented calls to look similar in assembler. It worked fine until >>>> I tried it with LTO where assembler name is used as a unique >>>> identifier. With linker resolutions files it became even more harder >>>> to use such approach. To resolve these issues I started to use new >>>> assembler name with postfix, but linked with the original name using >>>> IDENTIFIER_TRANSPARENT_ALIAS. It gives different assembler names for >>>> clones and originals during compilation, but both clone and original >>>> functions have similar name in output assembler. >>> >>> OK. So if I read that correctly, it implies that the existence of bounds >>> information does not change the signature of the callee. This is obviously >>> important for C++. >>> >>> Sounds like I need to sit down with the branch and see how this works in the >>> new scheme. >> >> Both mpx branch and Wiki >> (http://gcc.gnu.org/wiki/Intel%20MPX%20support%20in%20the%20GCC%20compiler) >> page are up-to-date now and may be tried out either in NOP mode or >> with simulator. Let me know if you have any troubles with using it. >> > > I built it. But "-fcheck-pointer-bounds -mmpx" doesn't generate > MPX enabled executable which runs on both MPX-enabled and > non MPX-enabled hardwares. I didn't see any MPX run-time library. Just checked out the branch and checked generated code. #cat test.c int test (int *p, int i) { return p[i]; } #gcc -fcheck-pointer-bounds -mmpx test.c -S -O2 #cat test.s .file "test.c" .section .text.unlikely,"ax",@progbits .LCOLDB0: .text .LHOTB0: .p2align 4,,15 .globl test .type test, @function test: .LFB1: .cfi_startproc movslq %esi, %rsi leaq (%rdi,%rsi,4), %rax bndcl (%rax), %bnd0 bndcu 3(%rax), %bnd0 movl (%rax), %eax bnd ret .cfi_endproc ... Checks are here. What do you see in your test? Ilya > > -- > H.J.