From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 118405 invoked by alias); 16 Feb 2017 16:15:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 107266 invoked by uid 89); 16 Feb 2017 16:15:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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, 16 Feb 2017 16:15:19 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C28B80460; Thu, 16 Feb 2017 16:15:18 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1GGFFYa002094; Thu, 16 Feb 2017 11:15:15 -0500 Subject: Re: [PATCH V7] amd64-mpx: initialize bnd register before performing inferior calls. To: "Tedeschi, Walfred" , "qiyaoltc@gmail.com" , "brobecker@adacore.com" References: <1485875613-31975-1-git-send-email-walfred.tedeschi@intel.com> <53d42bb6-3b83-6213-4087-6d30e7d837de@redhat.com> <217a8c13-b7d0-7fe6-56b5-85ff53ce097a@intel.com> <88c7180f-8843-a148-425a-2adf56c6d0bf@redhat.com> <32693426-fbaf-8345-04c7-e2c329d6ec6e@intel.com> <65ae9889-ab18-7228-c612-d47ec728174f@redhat.com> Cc: "gdb-patches@sourceware.org" From: Pedro Alves Message-ID: <8ef81952-9bf6-3d1a-1b91-ba77cf9c716f@redhat.com> Date: Thu, 16 Feb 2017 16:15:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2017-02/txt/msg00444.txt.bz2 On 02/16/2017 03:36 PM, Tedeschi, Walfred wrote: > FRED: > So, stopped at 0x0000000000400a0b set BND0 and did a step instruction and printed BND0 > Commands were: > P $bnd0={0xFFFFF..., 0} > Si > P $bnd0 (output was the same as input) That seems expected. > > For the value I set I should have got an segv. But I did not. >> Other way is to do instruction stepping till " bndmov %bnd3,-0x80(%rbp)" >> and examine the memory at the indicated places. > > Memory? I thought you'd examine the registers? What indicated places, BTW? > > FRED: > Yes, tring to discover what happened to the set I stepped instructions till 0x0000000000400a2f > This tells me that the BND0 should be at 0x50(%rbp) Ah, yes I see what you mean now. Well, actually it should be at -0x50(%rbp) [negative]. Now I don't know whether that was just a typo. :-P Otherwise something's very odd indeed. > but value was not the one I added by hand but the automatically set (with the patch) > Interestingly without the patch, and repeating the same procedure, the value is the one I have set by hand while stopped at the prolog. Could your patch be clearing something that disables bnd-related instructions completely? Perhaps %bndcfgu? In your patch you have: for (int i = 0; i < I387_BND0R_REGNUM (tdep); i++) regcache_raw_write (regcache, I387_BND0R_REGNUM (tdep) + i, bnd_buf); What does the "I387_BND0R_REGNUM (tdep)" in the for loop condition mean? That should have been "the number of bnd registers" I suppose, but doesn't look like that's what the code is really doing, as I387_BND0R_REGNUM is really the number of the _first_ bnd register, AFAICS. Shouldn't that be I387_NUM_BND_REGS instead, like: for (int i = 0; i < I387_NUM_BND_REGS; i++) regcache_raw_write (regcache, I387_BND0R_REGNUM (tdep) + i, bnd_buf); ? Thanks, Pedro Alves