From patchwork Wed Aug 21 15:58:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 34229 Received: (qmail 115893 invoked by alias); 21 Aug 2019 15:58:43 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 115829 invoked by uid 89); 21 Aug 2019 15:58:42 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: EUR02-VE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr20088.outbound.protection.outlook.com (HELO EUR02-VE1-obe.outbound.protection.outlook.com) (40.107.2.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Aug 2019 15:58:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2CciE2IMURxHV0UFa3QZMRKekm/C2CxN2zm4BdR1prM=; b=9l9poCOOFPc+rl5Fmf/kVkBXp/KDl/gpCUtREnr89tRDhK3/0v4LOJU4l2jU+WyLZQBUdFTCv2HPykCzQib6ijD1pL4AtGfUyaD235+a9Lik+QekbuyyUIf+kcNnz3rdN8BdgYEU1GkC0jVPzkkGr2HLsdvZx2UHjBh6CHTEUgA= Received: from VI1PR08CA0174.eurprd08.prod.outlook.com (2603:10a6:800:d1::28) by AM5PR0802MB2594.eurprd08.prod.outlook.com (2603:10a6:203:99::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Wed, 21 Aug 2019 15:58:35 +0000 Received: from VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e09::207) by VI1PR08CA0174.outlook.office365.com (2603:10a6:800:d1::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Wed, 21 Aug 2019 15:58:34 +0000 Authentication-Results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; sourceware.org; dmarc=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT018.mail.protection.outlook.com (10.152.18.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2178.16 via Frontend Transport; Wed, 21 Aug 2019 15:58:33 +0000 Received: ("Tessian outbound 578a71fe5eaa:v26"); Wed, 21 Aug 2019 15:58:29 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9e5839f46c055882 X-CR-MTA-TID: 64aa7808 Received: from 3efed9d41f37.3 (cr-mta-lb-1.cr-mta-net [104.47.4.50]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7560A2E9-7DE7-4405-8835-03F67F8B02AD.1; Wed, 21 Aug 2019 15:58:23 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02lp2050.outbound.protection.outlook.com [104.47.4.50]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3efed9d41f37.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384); Wed, 21 Aug 2019 15:58:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VDHBZ7OaEppIjzx7EJVBHm+n6Il89C3f4geC+gJO2Vt/0TrOB03wog2SHiQYnzpSPt13hb787+xen9LC3Os0JmnP2XMES4QZH2HR/XjGyMwKJ+bnQEeiRnajsW0F+59gF4ycfnHDpmQNnOS01xyXKJ8Z4ID/bCQUZz4280WeuJV+QQieCBr8yVH/sznoALqmXgEyB+xFPN9R+/eHjqzPaMrBvqgD10kiEt5KCxu9PLi/2v5pS1WEFcSHUvqDfw7cgIWNXK26S/I/XgEl6lGnZJ6i7c0eFlFwNNumg2K0bBVLpWs5Lz5ClvcGQrJLo5L64OuT60lB28nDfEr/xBJ5Bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2CciE2IMURxHV0UFa3QZMRKekm/C2CxN2zm4BdR1prM=; b=IgMOZbExFQiov7X3UfO2Mpv8dnVrQsNHCNQ9kf63dDB2qbv4n7FHDcOwCB2jydzrTCWgQaSe4KFpzBggUVGq4IRcGGAt4e7YsMlm0YbEyot0ch2kI02HZZ4qrQKwK8esOPQjYfCf980qvAGnQZaHTcn8nw1Slc0pfAKH17J4Ggi8qMpmaIrhkaOBB3yTLbGIAAc+faEx0bq5KUN5/225KYTZcRJaHS/rxnIOo9o6ZfVVd2t169B/uOz7hd2T+EYLFrN2Bx1V8wy057HzjJKDwdVhTRTH6jFu3BaQjmwnYI7QTeqT8FzwpMuZXeLYmpmRe/+Ip3W3TtTKd2/vDL4aCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2CciE2IMURxHV0UFa3QZMRKekm/C2CxN2zm4BdR1prM=; b=9l9poCOOFPc+rl5Fmf/kVkBXp/KDl/gpCUtREnr89tRDhK3/0v4LOJU4l2jU+WyLZQBUdFTCv2HPykCzQib6ijD1pL4AtGfUyaD235+a9Lik+QekbuyyUIf+kcNnz3rdN8BdgYEU1GkC0jVPzkkGr2HLsdvZx2UHjBh6CHTEUgA= Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com (10.172.227.22) by DB6PR0802MB2344.eurprd08.prod.outlook.com (10.172.228.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.19; Wed, 21 Aug 2019 15:58:22 +0000 Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::8c83:15d:248f:3a]) by DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::8c83:15d:248f:3a%10]) with mapi id 15.20.2178.020; Wed, 21 Aug 2019 15:58:22 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: nd , Alan Hayward Subject: [PATCH v2 3/3] Check arguments for all probes before using them Date: Wed, 21 Aug 2019 15:58:22 +0000 Message-ID: <20190821155816.45504-4-alan.hayward@arm.com> References: <20190821155816.45504-1-alan.hayward@arm.com> In-Reply-To: <20190821155816.45504-1-alan.hayward@arm.com> Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; X-Microsoft-Antispam-Untrusted: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:DB6PR0802MB2344; X-MS-Exchange-PUrlCount: 1 x-ms-exchange-transport-forked: True x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:6430;OLM:6430; X-Forefront-Antispam-Report-Untrusted: SFV:NSPM; SFS:(10009020)(4636009)(366004)(376002)(346002)(396003)(136003)(39860400002)(189003)(199004)(54534003)(476003)(11346002)(486006)(2616005)(446003)(25786009)(478600001)(2501003)(86362001)(66066001)(1076003)(6486002)(14454004)(53936002)(966005)(5640700003)(81166006)(81156014)(8936002)(44832011)(8676002)(4326008)(5660300002)(50226002)(102836004)(36756003)(66946007)(76176011)(6512007)(6916009)(6436002)(386003)(6506007)(3846002)(2351001)(71190400001)(71200400001)(6116002)(52116002)(6306002)(305945005)(186003)(14444005)(256004)(316002)(7736002)(26005)(66476007)(99286004)(2906002)(66446008)(64756008)(66556008)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0802MB2344; H:DB6PR0802MB2133.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: XKxvDlZ9Pt9VpgIpu+NJTwlxtEIIWoGJjuxCmISvf/ADIrpO6DpdyZvWH82keMsxITHdSN722oFINaldsOpIf8GB8MCOvqQPtTGfQFfcOYnYaR+JT4ZZsjS+9WbquDt8hmYvrbw1EVv2WcWsySAn1vKQsZnK3doJRabUYk9i2UKVu/3KICBtM8ZdAqz8JmjXKbj5ok3dx3W5wDjBDs5b0qe0ORBrd1/FCJ4HuIU9gwY1W3FKXLRSZ5n79ROMqGjH+BRI33fMylrD4pc2/X/P61LoGLFt8q/hBFoTDauRGRRQF9rYLgSoHoB+0HJpklNOnL7JlcmjWmyP8FXqt5nwbZrUOB++V5WYnE4Uw3f2oZntRk6yC/g2gEIGNmBoRdCqex7VWrLFyHJRVypCVyV5dcESPFyPzGFdrSRdfDaPHLY= MIME-Version: 1.0 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; Return-Path: Alan.Hayward@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 463c72b7-9cfa-4021-b812-08d72650647a X-IsSubscribed: yes There is a long standing bug in the Arm toolchain where invalid stap probes get created due to the probes referring to symbols which have been resolved away. More details are here: https://bugzilla.redhat.com/show_bug.cgi?id=1196181 When these invalid probes are present, GDB will create the breakpoints and then fail to stop. The errors are only spotted the first time GDB stops, which is too late. The solution is to ensure the arguments for all the probes are resolved before using them. This fixes >100 timeouts when running break-interp.exp when using bad probes. gdb/ChangeLog: 2019-08-21 Alan Hayward * solib-svr4.c (svr4_find_and_create_probe_breakpoints): Check all probe arguments. --- gdb/solib-svr4.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 2a44dd6985..ffae26bfc5 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -2071,7 +2071,6 @@ svr4_find_and_create_probe_breakpoints (svr4_info *info, bool with_prefix) { std::vector probes[NUM_PROBES]; - bool checked_can_use_probe_arguments = false; for (int i = 0; i < NUM_PROBES; i++) { @@ -2102,12 +2101,23 @@ svr4_find_and_create_probe_breakpoints (svr4_info *info, return false; /* Ensure probe arguments can be evaluated. */ - if (!checked_can_use_probe_arguments) + for (probe *p : probes[i]) { - probe *p = probes[i][0]; if (!p->can_evaluate_arguments ()) return false; - checked_can_use_probe_arguments = true; + /* This will fail if the probe is invalid. This has been seen on Arm + due to references to symbols that have been resolved away. */ + try + { + p->get_argument_count (gdbarch); + } + catch (const gdb_exception_error &ex) + { + exception_print (gdb_stderr, ex); + warning (_("Initializing probes-based dynamic linker interface " + "failed.\nReverting to original interface.")); + return false; + } } }