From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 100930 invoked by alias); 10 Oct 2018 08:23:10 -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 99946 invoked by uid 89); 10 Oct 2018 08:23:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=HContent-Transfer-Encoding:8bit 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; Wed, 10 Oct 2018 08:23:08 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DAB3830DF71D; Wed, 10 Oct 2018 08:23:06 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id E9C305B6FA; Wed, 10 Oct 2018 08:23:05 +0000 (UTC) Subject: Re: [PATCH v2 0/2] Aarch64: Fix segfault when casting dummy calls To: Alan Hayward References: <20181001155255.14859-1-alan.hayward@arm.com> <57873989-fc65-634f-c6f8-8c2a976e4f9f@redhat.com> Cc: GDB Patches , nd From: Pedro Alves Message-ID: Date: Wed, 10 Oct 2018 08:23:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-SW-Source: 2018-10/txt/msg00242.txt.bz2 On 10/09/2018 06:50 PM, Alan Hayward wrote: > > >> On 9 Oct 2018, at 17:10, Pedro Alves wrote: >> >> On 10/01/2018 04:52 PM, Alan Hayward wrote: >>> This is a reworking of a patch I posted in March. >>> V1 had a long discussion which was then paused to wait for >>> Pedro's IFUNC rewrite. >>> >>> >>> Prevent the int cast in the following causing a segfault on aarch64: >>> (gdb) b foo if (int)strcmp(name,"abc") == 0 >>> (gdb) run >>> >>> >>> This is because to aarch64_push_dummy_call determines the return type >>> of the function and then does not check for null pointer. >>> >>> A null pointer for the return type means either 1) the call has a >>> cast or 2) an error has occured. >> >> I'd think that "1) the call has a cast" is not accurate. >> If the called function has debug info, then GDB will know >> it's return type. The issue is that the called function may >> not have debug information, and then GDB does not know >> its return type (so its NULL), and then the only way to >> call the function is to add the cast. Right? >> > > That makes sense. I’d add that in the above example I’m able to do the > break without a cast and gdb does not segfault - the return type > of the function comes back as an int. Please double check whether the proposed testcase crashes GDB without the fix. I suspect not, due to the library being compiled with debug info. If it does crash, then I think I'm missing something. Thanks, Pedro Alves