From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 349231F5AE for ; Thu, 23 Jul 2020 18:41:12 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B8BBC388CC26; Thu, 23 Jul 2020 18:41:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8BBC388CC26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1595529670; bh=wl7qscYOsq+V5Vi8GxI/QM7ZeeZMsjMFlszyexkLHCI=; h=To:Subject:Date:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=gRLLL0V6tMrt+z5rZIwHpRhuj7mDz5z8d3F8+OcrBg5FVKnxfo8eg7Cd78/XTtTaU WZaQqEzpXTXSReTs+uhagiWqjiMSeMDmv9dD3D+wFRiMExOj6CWG/h3XUs0L1cPncN d7Rfz5ahEMWxJA2C6ZeIq0Tje5zT8GiPfEr42T8E= Received: from rcdn-iport-4.cisco.com (rcdn-iport-4.cisco.com [173.37.86.75]) by sourceware.org (Postfix) with ESMTPS id CA05E3857C5B for ; Thu, 23 Jul 2020 18:41:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CA05E3857C5B IronPort-PHdr: =?us-ascii?q?9a23=3APXEbThEkQU78hyL9tEKcu51GYnJ96bzpIg4Y7I?= =?us-ascii?q?YmgLtSc6Oluo7vJ1Hb+e401QGbR4jX6/tYzeHRtvOoVW8B5MOHt3YPONxJWg?= =?us-ascii?q?QegMob1wonHIaeCEL9IfKrCk5yHMlLWFJ/uX3uN09TFZXkalHSq2H05jkXSV?= =?us-ascii?q?3zMANvLbHzHYjfx828y+G1/cjVZANFzDqwaL9/NlO4twLU48IXmoBlbK02z0?= =?us-ascii?q?jE?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0ApAAAo2Rlf/4QNJK1gGgEBAQEBAQE?= =?us-ascii?q?BAQEDAQEBARIBAQEBAgIBAQEBQIE5AgEBAQELAYFRUQeBRy8sCodvA41TgQG?= =?us-ascii?q?OTIkSgUKBEQNVCwEBAQwBAS0CBAEBhEwCghoCJDcGDgIDAQELAQEFAQEBAgE?= =?us-ascii?q?GBG2FXAyFcgEBAQMSFRMGAQE3AQ8CAQgYHhAUHicEDhkOhVADLgGjKQKBOYh?= =?us-ascii?q?hdIEBM4MBAQEFhTgYgg4JFIEkAYJriggagUE/gRGCWzU+hAA9g0mCLZIhhze?= =?us-ascii?q?cBAqCXZlaMA+CbIlEkxyxGgIEAgQFAg4BAQWBaSSBV3AVO4JpUBcCDY4eDBe?= =?us-ascii?q?DTopWdDcCBggBAQMJfI4FAYEQAQE?= X-IronPort-AV: E=Sophos;i="5.75,387,1589241600"; d="scan'208";a="786152181" Received: from alln-core-10.cisco.com ([173.36.13.132]) by rcdn-iport-4.cisco.com with ESMTP/TLS/DHE-RSA-SEED-SHA; 23 Jul 2020 18:40:59 +0000 Received: from XCH-RCD-001.cisco.com (xch-rcd-001.cisco.com [173.37.102.11]) by alln-core-10.cisco.com (8.15.2/8.15.2) with ESMTPS id 06NIexvj016000 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=FAIL); Thu, 23 Jul 2020 18:40:59 GMT Received: from xhs-aln-002.cisco.com (173.37.135.119) by XCH-RCD-001.cisco.com (173.37.102.11) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Jul 2020 13:40:59 -0500 Received: from xhs-rcd-003.cisco.com (173.37.227.248) by xhs-aln-002.cisco.com (173.37.135.119) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 23 Jul 2020 13:40:58 -0500 Received: from NAM02-BL2-obe.outbound.protection.outlook.com (72.163.14.9) by xhs-rcd-003.cisco.com (173.37.227.248) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Thu, 23 Jul 2020 13:40:58 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=itVbrvUs3QjCpJzrUNStp8sEOhOASvIDaaNEm36p7ktcJBAQf801ltQOn2PegfGvCL4lVLAFQhO0DVFifQ6rACBCFIfgfWU6YcnV8VLzv31Jt5/T1ySoC+Wq654XDGfiPy1cqiMrGpyb/j+6imcLlJBHYmB1ZM/PAyHBmyVjjDgGrPGv0DnFzyFCie/+9MbSl/FO/J+mhpjdSaM3VtAVuX9B2a/NnOJkZT/8xhlnsxznn3D62GMWm2dGr0GLF60itB1GDv6EL2Y6d64Zn9ybf9szt5wcoccsdyJw2cAkKcsolVOVxMuQ/4tjJeJzImpQDPNJO74/outRMJAFpxS4Mg== 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=wl7qscYOsq+V5Vi8GxI/QM7ZeeZMsjMFlszyexkLHCI=; b=F+QqB8cSMGFXpjQaYo87mLX3ySKKXrEA7n/nYlP5p/zQlsdCjHxackFuEfSg9tzcYiIfWAF+ftABQgz2SiL9jMVqsfybj40zVMEKxm4WJ6Clby7uE+iQaCEP/8cntwZfJZ7FieGQkVpe6Ln6O3fAtjpTXT120lVvRbutGWIJeWvq5XMJfzJIAKLBRl6DEfZJ4kq1E1jMrxSlJsPXN2GbffG6g2hQoBn0ejkl7WuJhPcymBy/DCh3R4ngK69HbAfc1Epn4JkifaPzwezu1/P6VUOCg7Q1JsVjQO3XCek8M4+qlAYzbj1DF9YHGpiSUvKpgwbmeXwZrmxXIT4hHz5GgQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cisco.com; dmarc=pass action=none header.from=cisco.com; dkim=pass header.d=cisco.com; arc=none Received: from BYAPR11MB3205.namprd11.prod.outlook.com (2603:10b6:a03:1e::32) by BYAPR11MB3797.namprd11.prod.outlook.com (2603:10b6:a03:fe::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.18; Thu, 23 Jul 2020 18:40:55 +0000 Received: from BYAPR11MB3205.namprd11.prod.outlook.com ([fe80::4c19:cf97:4c5c:384f]) by BYAPR11MB3205.namprd11.prod.outlook.com ([fe80::4c19:cf97:4c5c:384f%7]) with mapi id 15.20.3195.025; Thu, 23 Jul 2020 18:40:55 +0000 To: "Carlos O'Donell" Subject: Re: [RFC PATCH 0/3] implement dlmopen hooks for gdb Thread-Topic: [RFC PATCH 0/3] implement dlmopen hooks for gdb Thread-Index: AQHWYSDMTjhr79rEo0OnqjnlYwfyPA== Date: Thu, 23 Jul 2020 18:40:55 +0000 Message-ID: <20200723184054.GD9875@zorba> References: <20200626193228.1953-1-danielwa@cisco.com> <0f791d3a-20bc-4524-54eb-ce6df108fbff@redhat.com> In-Reply-To: <0f791d3a-20bc-4524-54eb-ce6df108fbff@redhat.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-Auto-Response-Suppress: DR, OOF, AutoReply X-MS-TNEF-Correlator: user-agent: Mutt/1.9.4 (2018-02-28) x-originating-ip: [128.107.241.169] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bb74ae29-eff6-46e7-c7ce-08d82f37ef26 x-ms-traffictypediagnostic: BYAPR11MB3797: x-ld-processed: 5ae1af62-9505-4097-a69a-c1553ef7840e,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ytwyIenGE8DgACP3UlVS2XKujnDr+4qeD4feMyyi3AphSBaEIslWfcn105fq6tVVoYq/dr4liY+7OSB/bwdpyTKKwO7uvSqX96tg0aU4/rNpYtXz8sFHYvEUuUsKroHUpHrRztChnGoeq5Bp6lLFS69Bw9SV9fpRMEzD0X5KPd/tD+lW6tQpEDC2Yy8Mt3HzN9KeW8aYRNdLYioiOr/IlO+itJnfFJcc1+K2QBH5p9OxJXOX0rWetX5PCPVfNXMmK1sqdS2eZaQTR/xPTKCssM9kUMootmmgdtsqH7VPkDnSvJS2Bah8nq5cB80gbPB8KJCRzQbtREvsScDl1063eg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3205.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(7916004)(4636009)(39860400002)(396003)(346002)(136003)(366004)(376002)(316002)(5660300002)(2906002)(71200400001)(1076003)(54906003)(83380400001)(66446008)(6512007)(186003)(107886003)(9686003)(6506007)(66476007)(6486002)(26005)(478600001)(66946007)(76116006)(86362001)(66556008)(33716001)(64756008)(8676002)(4326008)(33656002)(8936002)(53546011)(6916009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: UZfHXpHPhktSugBtFoGQTeWZzhdLPuf1MtMlu/BOYio7wqaf+b3Qq3zi7PbLtWyCvRZpoHZ/3k4o5EkS4Nc2rK2N6BB4G/NjHULstckW9i7CWmJhlywiLZ5uPsb6g5qVRXGv9p9hqIwGfiTkYKi0QCsgq9Nv9kmv8QwcC9cc/4uB38j6Ss9YUcrwx0NLeWLxXuuWc+rhg4sGyqhBLChtHj/+EkirLmBBZ2sSO7AsAYosokQvHf2H2clc2t0hUz1Zhwvm1nJbEKqD5EZ9XgmDBk5LfT9zKP/ygRMavCsKR/J+CbEHzAC3qts62EUo7P+NUmPlGwtcbwRPUv28E9GcZfZ/RVveaz5RB1l80zbzRkr5eBU2x6P6VQsvVuyG4fjatnHro4+kQPwcD0I3A68bO9pOnE5UymTwAvYyRSexCv/hRe6CcJliAHlkFlnYD83upP/zV44fbNQ5JfeuVaaf14fBaRFqAbyhRLcqtvN3OVi9+bEukUSxTueOUCOHNfMO Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3205.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bb74ae29-eff6-46e7-c7ce-08d82f37ef26 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jul 2020 18:40:55.2749 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 5ae1af62-9505-4097-a69a-c1553ef7840e X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Tempemj5x1uuO6n/bXrNLoXYOgEcjXLx4It8dlEMRcaTVKUZR1rxTyWLJQQOo5eL5EsG6dlSM1KcrHieQlcfcw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3797 X-OriginatorOrg: cisco.com X-Outbound-SMTP-Client: 173.37.102.11, xch-rcd-001.cisco.com X-Outbound-Node: alln-core-10.cisco.com X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: "Daniel Walker \(danielwa\) via Libc-alpha" Reply-To: "Daniel Walker \(danielwa\)" Cc: Florian Weimer , Pedro Alves , "libc-alpha@sourceware.org" , "Jeremy Stenglein \(jstengle\)" , "xe-linux-external\(mailer list\)" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On Fri, Jun 26, 2020 at 05:17:17PM -0400, Carlos O'Donell wrote: > On 6/26/20 3:32 PM, Daniel Walker via Libc-alpha wrote: > > Cisco System, Inc. has a need to have dlmopen support in gdb, which > > required glibc changes. I think it was known when glibc implemented > > dlmopen that gdb would not work with it. > >=20 > > Since 2015 Cisco has had these patches in our inventor to fix issues in > > glibc which prevented this type of gdb usage. > >=20 > > This RFC is mainly to get guidance on this implementation. We have some > > individuals who have signed the copyright assignment for glibc, and we > > will submit these (or different patches) formally thru those channels i= f > > no one has issues with the implementation. > >=20 > > Also included in this are a couple of fixes which went along with the > > original implementation. > >=20 > > Please provide any comments you might have. > >=20 > > Conan C Huang (3): > > Segfault when dlopen with RTLD_GLOBAL in dlmopened library > > glibc: dlopen RTLD_NOLOAD optimization > > add r_debug multiple namespaces support > >=20 > > elf/dl-close.c | 7 ++++++- > > elf/dl-debug.c | 13 ++++++++++--- > > elf/dl-open.c | 8 +++++++- > > elf/link.h | 4 ++++ > > 4 files changed, 27 insertions(+), 5 deletions(-) > >=20 >=20 > Thanks for looking at this. It is something the community would > absolutely like to see. I'll comment quickly to provide direction. >=20 > Florian Weimer, Pedro Alves, and I were talking about this as > recently as April where we tried to agree to just adding a > _r_debug_dlmopen with a new ABI for the debugger to use. >=20 Here's another RFC I suppose. It's basic code I've only compile tested. It'= s based on the comments, and the threads you provided. It just abstracts out = the next link into another structure. Let me know if this is in the ballpark of= the discussions. --- elf/dl-debug.c | 19 +++++++++++++++++-- elf/link.h | 6 ++++++ sysdeps/generic/ldsodefs.h | 1 + 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/elf/dl-debug.c b/elf/dl-debug.c index 4b3d3ad6ba..d0009744f8 100644 --- a/elf/dl-debug.c +++ b/elf/dl-debug.c @@ -35,6 +35,7 @@ extern const int verify_link_map_members[(VERIFY_MEMBER (= l_addr) a statically-linked program there is no dynamic section for the debugge= r to examine and it looks for this particular symbol name. */ struct r_debug _r_debug; +struct r_debug_dlmopen _r_debug_dlmopen; =20 =20 /* Initialize _r_debug if it has not already been done. The argument is @@ -45,11 +46,22 @@ struct r_debug * _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns) { struct r_debug *r; + struct r_debug_dlmopen *r_ns, *rp_ns; =20 if (ns =3D=3D LM_ID_BASE) - r =3D &_r_debug; + { + r =3D &_r_debug; + r_ns =3D &_r_debug_dlmopen; + } else - r =3D &GL(dl_ns)[ns]._ns_debug; + { + r =3D &GL(dl_ns)[ns]._ns_debug; + r_ns =3D &GL(dl_ns)[ns]._ns_debug_dlmopen; + rp_ns =3D &GL(dl_ns)[ns - 1]._ns_debug_dlmopen; + rp_ns->next =3D r_ns; + if (ns - 1 =3D=3D LM_ID_BASE) + _r_debug_dlmopen.next =3D r_ns; + } =20 if (r->r_map =3D=3D NULL || ldbase !=3D 0) { @@ -58,6 +70,9 @@ _dl_debug_initialize (ElfW(Addr) ldbase, Lmid_t ns) r->r_ldbase =3D ldbase ?: _r_debug.r_ldbase; r->r_map =3D (void *) GL(dl_ns)[ns]._ns_loaded; r->r_brk =3D (ElfW(Addr)) &_dl_debug_state; + r_ns->r_debug =3D r; + r_ns->next =3D NULL; + } =20 return r; diff --git a/elf/link.h b/elf/link.h index 0048ad5d4d..c81945b671 100644 --- a/elf/link.h +++ b/elf/link.h @@ -63,8 +63,14 @@ struct r_debug ElfW(Addr) r_ldbase; /* Base address the linker is loaded at. */ }; =20 +struct r_debug_dlmopen + { + struct r_debug *r_debug; + struct r_debug_dlmopen *next; + }; /* This is the instance of that structure used by the dynamic linker. */ extern struct r_debug _r_debug; +extern struct r_debug_dlmopen _r_debug_dlmopen; =20 /* This symbol refers to the "dynamic structure" in the `.dynamic' section of whatever module refers to `_DYNAMIC'. So, to find its own diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index ba114ab4b1..d9794bc7a0 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -357,6 +357,7 @@ struct rtld_global } _ns_unique_sym_table; /* Keep track of changes to each namespace' list. */ struct r_debug _ns_debug; + struct r_debug_dlmopen _ns_debug_dlmopen; } _dl_ns[DL_NNS]; /* One higher than index of last used namespace. */ EXTERN size_t _dl_nns; --=20 2.17.1