From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 121868 invoked by alias); 27 Jun 2018 23:01:32 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 121852 invoked by uid 89); 27 Jun 2018 23:01:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.4 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_NUMSUBJECT,KAM_SHORT,SPF_PASS autolearn=no version=3.3.2 spammy=HContent-type:text, HContent-type:charset, HContent-type:plain, HContent-type:iso-8859-1 X-Spam-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_NUMSUBJECT,KAM_SHORT,SPF_PASS autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: smtpauth4.wiscmail.wisc.edu Received: from wmauth4.doit.wisc.edu (HELO smtpauth4.wiscmail.wisc.edu) (144.92.197.145) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Jun 2018 23:01:29 +0000 Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03lp0024.outbound.protection.outlook.com [207.46.163.24]) by smtpauth4.wiscmail.wisc.edu (Oracle Communications Messaging Server 8.0.1.1.0 64bit (built Jun 15 2016)) with ESMTPS id <0PB0000KT7YECL10@smtpauth4.wiscmail.wisc.edu> for elfutils-devel@sourceware.org; Wed, 27 Jun 2018 18:01:27 -0500 (CDT) X-Spam-Report: AuthenticatedSender=yes, SenderIP=[207.46.163.24] X-Wisc-Env-From-B64: ZGFyb2NoYXBpbmhlQHdpc2MuZWR1 X-Spam-PmxInfo: Server=avs-4, Version=6.4.3.2751440, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2018.6.27.225116, AntiVirus-Engine: 5.50.0, AntiVirus-Data: 2018.6.17.5500001, SenderIP=[207.46.163.24] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wisc.edu; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YHd/kSvjVGAohcCdwjetR4vWvtxgkICZDluDQRRYi8k=; b=JCVgbg31m5ZM93EQVRue87Lb+v4+JBZbwf25oyTRuI4kJbjPlc8pvpMVGUDgjjsqpn7q9pcbWyuNV1af/kitZhuT25bFMjD7/sWgMgongUr0SAwiaRn/Vxve7/VqWIvgVoOy5gz3DxU7mU7vBlgKoDVCvZ+zkzvzbhl8p0EwQN0= Received: from BN6PR06MB2932.namprd06.prod.outlook.com (10.175.128.22) by BN6PR06MB3188.namprd06.prod.outlook.com (10.174.232.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.20; Wed, 27 Jun 2018 23:01:26 +0000 Received: from BN6PR06MB2932.namprd06.prod.outlook.com ([fe80::fd73:a262:d768:e4be]) by BN6PR06MB2932.namprd06.prod.outlook.com ([fe80::fd73:a262:d768:e4be%4]) with mapi id 15.20.0884.025; Wed, 27 Jun 2018 23:01:26 +0000 From: Sasha Da Rocha Pinheiro To: Mark Wielaard , "elfutils-devel@sourceware.org" Subject: Re: dwarf_next_cfi returns -1 Thread-topic: dwarf_next_cfi returns -1 Thread-index: AQHT/B9K/deFoJC+IUGt8+TCdSvfjaRRiBKAgCNUcPI= Date: Wed, 27 Jun 2018 23:01:00 -0000 Message-id: References: , <1528198037.12946.56.camel@klomp.org> In-reply-to: <1528198037.12946.56.camel@klomp.org> Accept-Language: en-US, pt-BR Content-language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: X-Originating-IP: [128.105.14.107] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BN6PR06MB3188;7:1s78KrV0dUJet0NPHS1BHuFyKdHOdjjCUjfUzdyCwBEOaf/vxOdhKkmgN+M0jtbW8wOA4d+WXVO1qOUfSRzHNBgPkL277C5zCyMukKEtz/3N+2le4cW4NI4ietRwjJJ04ZqWZHDBHLswWKu3RImkZUoGKhEcfgAKxON2h0cmFWOor/A5nt8CvEw3HP+8yECn3CePj6rxkoFTLMNmEm4IbaDq+Wax5n4oD/ABEie+vYUypUsxnndwMJlrjrOAB7we x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 2e0cee81-e263-4165-af81-08d5dc81e8f8 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020);SRVR:BN6PR06MB3188; x-ms-traffictypediagnostic: BN6PR06MB3188: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(273179264587236); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281529075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:BN6PR06MB3188;BCL:0;PCL:0;RULEID:;SRVR:BN6PR06MB3188; x-forefront-prvs: 0716E70AB6 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(346002)(136003)(396003)(376002)(366004)(39860400002)(199004)(189003)(478600001)(305945005)(7736002)(74316002)(966005)(25786009)(88552002)(97736004)(2906002)(2900100001)(14454004)(3846002)(6116002)(6246003)(86362001)(66066001)(53936002)(106356001)(229853002)(105586002)(5660300001)(33656002)(75432002)(6436002)(14444005)(53546011)(256004)(5250100002)(476003)(486006)(11346002)(102836004)(446003)(76176011)(6506007)(6346003)(6306002)(68736007)(786003)(99286004)(8676002)(81156014)(81166006)(7696005)(7116003)(2501003)(55016002)(110136005)(9686003)(186003)(316002)(26005)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR06MB3188;H:BN6PR06MB2932.namprd06.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: wisc.edu does not designate permitted sender hosts) Authentication-results: spf=none (sender IP is ) smtp.mailfrom=darochapinhe@wisc.edu; x-microsoft-antispam-message-info: bERFvaJIIc0GGcqkdkdIzO6YEQ69KEMNzX2RaGJhQ+Q/qoMHszvI29X2G5dF5NONp0cqdpyKRKmuTcTZ98bFBga7yVO25zmBDcSR5a2AbavzRL6rtuOl/RmfPKIt9u21ALDPXSRGzAR6O8OK1WxMnbZGKMHt02Whddpvz3DcDJz14h5GqIUwZy8KagDC43Ndl+MB7YeevXG1MH46nsOAT2ZNIyODD0LyT1FEFo8Wlu9nxr0EkpMjSqMRPMif87n47gUzwzEaVrwo6pnKiCIzVZ+Y05CJ8ih2DH+9d6TWPg8t1Cbo/It2HAPAX/5QcrdtVHnn7BoucszNYkYhf+Smm1PgnWw3ZIGrQGhGMZ9UDdI= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-type: text/plain; charset="iso-8859-1" Content-transfer-encoding: quoted-printable MIME-version: 1.0 X-OriginatorOrg: wisc.edu X-MS-Exchange-CrossTenant-Network-Message-Id: 2e0cee81-e263-4165-af81-08d5dc81e8f8 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jun 2018 23:01:25.8445 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 2ca68321-0eda-4908-88b2-424a8cb4b0f9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR06MB3188 X-SW-Source: 2018-q2/txt/msg00263.txt.bz2 This is a binary that infinite loops with dwarf_next_cfi -1 because the off= set is not updated. https://rice.box.com/s/yzul9oavplq1qdx12ozjpgssawea36xy A fix was done by saving the previous *next_off and comparing with the curr= ent, after getting -1 in the return value. Sasha =20=20 From: Mark Wielaard Sent: Tuesday, June 5, 2018 6:27:17 AM To: Sasha Da Rocha Pinheiro; elfutils-devel@sourceware.org Subject: Re: dwarf_next_cfi returns -1 =A0=20 On Mon, 2018-06-04 at 16:16 +0000, Sasha Da Rocha Pinheiro wrote: > We had a case where dwarf_next_cfi returns -1 but the offset does not > update, as we should expect by the comment: >=20 > =A0330=A0=A0=A0 On errors, returns -1.=A0 Some format errors will permit = safely > =A0331=A0=A0=A0 skipping to the next CFI entry though the current one is > unusable. > =A0332=A0=A0=A0 In that case, *NEXT_OFF will be updated before a -1 retur= n. > Is there a correct way to deal with it, or just check if the NEXT_OFF > had changed? A CFI entry starts with the length of that entry, so dwarf_next_cfi can often setup the next offset correctly. But if there is anything else "wrong" with the CFI entry (maybe it has a version or augmentation string not recognized) then it cannot reliably return the CFI entry. It is indeed a slightly inconvenient interface, you'll have to check whether the return value, if it is zero, all is fine, if it is 1 you reached the end, if it is -1 an error occurred. In that last case, if you really want to try you can try. *next_off having changed after the call means it might work (or not). If you have an example of a "wrong" (or not recognized) CFI that would be helpful. Thanks, Mark =20=20=20=20