From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77226 invoked by alias); 21 Dec 2015 17:23:23 -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 77217 invoked by uid 89); 21 Dec 2015 17:23:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=fulfilled, Hx-languages-length:2654, evil 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; Mon, 21 Dec 2015 17:23:22 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id DE68D693C2; Mon, 21 Dec 2015 17:23:20 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id tBLHNJ1A018775; Mon, 21 Dec 2015 12:23:20 -0500 Message-ID: <56783587.6010009@redhat.com> Date: Mon, 21 Dec 2015 17:23:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Tedeschi, Walfred" , Joel Brobecker CC: "gdb-patches@sourceware.org" Subject: Re: [PATCH v1] Intel(R) MPX - Bound violation handling. References: <1445864086-4831-1-git-send-email-walfred.tedeschi@intel.com> <1445864086-4831-4-git-send-email-walfred.tedeschi@intel.com> <20151119000134.GB7958@adacore.com> <566F0E37.8090905@redhat.com> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-12/txt/msg00444.txt.bz2 Hi Walfred, (Please don't top post.) On 12/15/2015 10:58 AM, Tedeschi, Walfred wrote: > From: Pedro Alves [mailto:palves@redhat.com] > On 12/14/2015 05:43 PM, Tedeschi, Walfred wrote: >>> >> + set_running (user_visible_resume_ptid (1), 0); >> > >> > This is the part that _really_ concerns me, not necessary because I think it's wrong (although, it is a big red flag for me), but because I don't understand why it's needed, and how it will affect things. >> > (From Joel) >>> >> + si_code = parse_and_eval_long ("$_siginfo.si_code\n"); >> > >> > During the debugging time I understood that inferior was stopped. Gdb is that was in the process to determine in which state the inferior was. >> > In this sense I set the flag at this point to allow for the evaluation. > Where is the error thrown that required brute-forcing set_running away? > Can we try to find some other way to handle this? E.g., use something a bit lower level than parse_and_eval_long that bypasses the error? E.g., start from lookup_internalvar and then use type/value manipulation routines? > > It comes from the infrun.c (validate_siginfo_access) . > The requirement is not running is not fulfilled. Also in the case that we execute a lookup_interval and ask for value_contents we trigger the same code. > > What would be the suggestion here: > Additional function to be used internally in infrun or add a flag. I gave this some thought, and ended up filling 2 PRs and a proposal forward: [Bug breakpoints/19388] Access $_siginfo in breakpoint (catch signal) condition https://sourceware.org/bugzilla/show_bug.cgi?id=19388 [Bug gdb/19389] GDB sometimes mistakenly allows accessing registers of running threads https://sourceware.org/bugzilla/show_bug.cgi?id=19389 I think that to move forward we should change validate_siginfo_access to check is_executing instead of is_running for now. I think it'll fix your case (please give it a try). It's the same check that we do to prevent accessing registers from a running thread. $_siginfo is conceptually really no different from registers -- we could think of it as just another register. I sent a patch that does that here, along with testcase that justifies it on its own, independently of MPX: [PATCH] Fix PR19388: Can't access $_siginfo in breakpoint (catch signal) condition https://sourceware.org/ml/gdb-patches/2015-12/msg00443.html By making this change, $_siginfo will become exposed to PR19389 too, just like registers, and we should definitely fix it, but that seems like a lesser evil than not being able to get at the info at all. Thanks, Pedro Alves