From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by sourceware.org (Postfix) with ESMTPS id CC7353894430 for ; Thu, 17 Jun 2021 11:56:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CC7353894430 Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15HBlZne023368; Thu, 17 Jun 2021 11:56:30 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 397w1y0vsc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Jun 2021 11:56:29 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 15HBj8pS033897; Thu, 17 Jun 2021 11:56:29 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2107.outbound.protection.outlook.com [104.47.70.107]) by aserp3020.oracle.com with ESMTP id 396wavdesd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Jun 2021 11:56:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c2t/D1eBZcUrw1uxhZTbm/oNuur7QcfYfxQdE9n8tEBQB61BI1LEQSMtAa8zk5YAXE9qWJzfFhKjukGsi/T4iLsON38D0ik3n1p7YSF0fHWWNTS4hol0DhYKHZSWsPVtARlU1Ce7r3GJm6HxCWSAiES3ey8nD49uxdUPlO/zsoDoaESfkhszJ2+hZHu25iFe7DaE4mK30EOzN59zssNzPY9ZVy3t2/5cAHKuxmP3TqnC1tNSGOztcHxem7UuBLGaSXsbwNugN3IKdlypVNIqm77EtW0fwLWK/dWgviwKPEAqniSUrmmVixNiAcr/4az+5GQMIVAr2nyzqvYD3AfGgw== 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=OVJCNV74wefsoxqOkuLljKKrp3DlqQWpkq2Jj0VPEwc=; b=lc9gBzH0Dr9l6jU7Vc1aZ1ieV7bdkSTmp7p9jGTxAfeqdSV8Wu7ChddiOQbbOv68NjVk7/wfsAKfyUJthcWUiQ/605GrryuVm7Ahp9tgbR3XNymYdFtLDc/f6KQTwvKjOJ+8W4lRo0JWHZ3zRnfIdvm7suYQfHcgIvzt2mtwbyTA6ZVIiLCFQEpsmgXz0eQnw/jAyqLDMf+3sxmlPaUvsV8V8mRa2T5mqEQJNf5q3xIw9uqUfqbq+InrVqf8oANEpHbgBJqAeC2+OtWBvgXNJ/wQAcYz0h+8XhXEOAQQD4euzBaKJGUlIsW1dgPUtsqYlL3t+k637n0EY6DlzQcqqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none Received: from BYAPR10MB2792.namprd10.prod.outlook.com (2603:10b6:a03:87::22) by SJ0PR10MB4637.namprd10.prod.outlook.com (2603:10b6:a03:2d6::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.18; Thu, 17 Jun 2021 11:56:27 +0000 Received: from BYAPR10MB2792.namprd10.prod.outlook.com ([fe80::99b0:3aec:e729:2456]) by BYAPR10MB2792.namprd10.prod.outlook.com ([fe80::99b0:3aec:e729:2456%6]) with mapi id 15.20.4242.019; Thu, 17 Jun 2021 11:56:27 +0000 From: Alfonso Alfonso Peterssen To: "libc-alpha@sourceware.org" , Florian Weimer Subject: Re: [External] : [PATCH] elf: Use _dl_catch_error from base namespace in dl-libc.c [BZ #27646] Thread-Topic: [External] : [PATCH] elf: Use _dl_catch_error from base namespace in dl-libc.c [BZ #27646] Thread-Index: AQHXYQIy+FmNUqnMGEurZ9lQXx0AGqsYHCoU Date: Thu, 17 Jun 2021 11:56:26 +0000 Message-ID: References: <87czsook3i.fsf@oldenburg.str.redhat.com> In-Reply-To: <87czsook3i.fsf@oldenburg.str.redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [81.6.44.124] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: bd5646ec-d310-4551-e40b-08d93186effa x-ms-traffictypediagnostic: SJ0PR10MB4637: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1zp+3TyNS22IbZPwLhfHIR45IH5waIPidIVDNhbo8Cpv+E47DLixPo0yLJrgyIFyiKeK1VXX/wzZe3BmwXXm4auvNJn8yFPLCnyLEv9JZaoZQdjU5vSFVsx6WU0/8bKeeBOKIsH8S5tkB5QbmmT7KHFV78K6nzhANWioFan5IHsEJGJoJb4eE/JtcPqgoIl1qp9D0TsvtaQs2adUEo+frczVEKci0t0HsEJIxl+hUQEt7ABsdTHx0rSd77lO0/QW0Q0RTEUv9eTwcNYN1sUda9tyQTfcLVSGc160B6OtOusKw486bTolhmOzUhvNZiNrew8pmp/RDST6x8NJNobZLvCWO3TxL8WoW5mYjJy80LwXozOzdoBMmhHTuMy0QWnJCRYF/jkYOfZRg3ym2mmbRdM/qdChxc+jf7d6DDmig54qjFSXwt5OtHe5Tbie5XhFXtwfcOo7TnoyD/hUbD7XkdPgfLDYoBUjTZLM9icCgvqx+ftueEkM0ht8p2wxX5jNZ9LxSn3EnNpiRRb+27dipEb/1qGosHrqUEkQUM73AWqgj5oxFmyISNwZEesyXbud6ZNnrbw/cEjC/lEO4BnoA2FhFaLkJsidR4hrmEj9Jkbtn/Ae4b3xCrlx75dEDj4c7MkbDmiQcVPFJ9TcIoG73ztUqS256t0x7gFk2wfp3IDQhfiNN4Tv+D/1r0iBpF7SIXwW5rtlOXCg9UDhewIpR8niXj1EMtCXWXupnPsf1YNxTc8pF9HUYJkhnJX1P2U2OZWu1nfECX25B0uOtEJ3T0C0TwvC6dfmNbg/TYyQ0II= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR10MB2792.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(366004)(396003)(39860400002)(346002)(136003)(122000001)(38100700002)(83380400001)(55016002)(33656002)(2906002)(110136005)(9686003)(6506007)(7696005)(8676002)(19627405001)(86362001)(316002)(5660300002)(186003)(64756008)(66946007)(18265965003)(66556008)(66476007)(26005)(76116006)(478600001)(91956017)(66446008)(52536014)(8936002)(71200400001)(2004002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?F6NpeAnEvvNb+2zdRVuZQy40uQ4pDYqffm7f2eawOYpwTHBzdxlTM+Yh7nuM?= =?us-ascii?Q?tfa/ll7mqu72Qqno3Jox2nQL+/yGpE4X/MSA/Ielxei+kD/PIqqcSwBOET4t?= =?us-ascii?Q?JFk1VDkpM7G4PYOX+RwSSOfXYEo/vyhqEDF7lAZvwUhAnsQ+rZUqLPuBOsmZ?= =?us-ascii?Q?IbbkBgSIiK0mIr69+beoeXKFkGSEcjNLkXe05qUhpdE0le/Ptdz9kcUMD++4?= =?us-ascii?Q?gevTLZ9d80/QeLHL6PugmavkIO+5UL9t/jtDMwytWNHxT7cQSkvyxJR4SFli?= =?us-ascii?Q?9OQqNmmFiny3HzW530MLLwYfQT9P9g6xYOcef3WkkTPPf4cfB8Yc468fBaqX?= =?us-ascii?Q?tW5CLsZxZ4KfKu9N5YwXzNmDxdpsbm0QrMHNnvngDKZDRxVbS0xhVyeOrEiC?=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4bX9+QrOsdT7mnV2J7Ih?= =?us-ascii?Q?xM8=3D?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB2792.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd5646ec-d310-4551-e40b-08d93186effa X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Jun 2021 11:56:27.0192 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 2XMbOwBwwgdQS4uf5BYc19lGzv+dw++pISJWuBPfjGQ8/ULU1VCl+A12VhL+iWg1nnEvhuQnq9UNiskbyPIuuK727hjt6Jb/B3TCv4w3cIk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4637 X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=10017 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 malwarescore=0 phishscore=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2106170078 X-Proofpoint-ORIG-GUID: DU1AdXsiSes-4irk_aEbrsy-_70vnzTZ X-Proofpoint-GUID: DU1AdXsiSes-4irk_aEbrsy-_70vnzTZ X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HTML_MESSAGE, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: , X-List-Received-Date: Thu, 17 Jun 2021 11:56:34 -0000 Tested locally, I confirm this fix [BZ #27646], the LD_DEBUG=3Dunused worka= round is not needed anymore. ________________________________ From: Libc-alpha on behalf of Florian Weimer via Libc-alpha Sent: Monday, June 14, 2021 11:45 AM To: libc-alpha@sourceware.org Subject: [External] : [PATCH] elf: Use _dl_catch_error from base namespace = in dl-libc.c [BZ #27646] dlerrror_run in elf/dl-libc.c needs to call GLRO (dl_catch_error) from the base namespace, just like the exported dlerror implementation. Fixes commit b2964eb1d9a6b8ab1250e8a881cf406182da5875 ("dlfcn: Failures after dlmopen should not terminate process [BZ #24772]"). Tested on i686-linux-gnu and x86_64-linux-gnu. --- elf/Makefile | 5 ++++- elf/dl-libc.c | 4 ++-- elf/tst-dlmopen-gethostbyname-mod.c | 29 +++++++++++++++++++++++++++++ elf/tst-dlmopen-gethostbyname.c | 31 +++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 3 deletions(-) diff --git a/elf/Makefile b/elf/Makefile index 5c47daee12..38d08e03b8 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -223,7 +223,7 @@ tests +=3D restest1 preloadtest loadfail multiload orig= test resolvfail \ tst-single_threaded tst-single_threaded-pthread \ tst-tls-ie tst-tls-ie-dlmopen argv0test \ tst-glibc-hwcaps tst-glibc-hwcaps-prepend tst-glibc-hwcaps-mask \ - tst-tls20 tst-tls21 tst-dlmopen-dlerror + tst-tls20 tst-tls21 tst-dlmopen-dlerror tst-dlmopen-gethostbyname # reldep9 tests-internal +=3D loadtest unload unload2 circleload1 \ neededtest neededtest2 neededtest3 neededtest4 \ @@ -347,6 +347,7 @@ modules-names =3D testobj1 testobj2 testobj3 testobj4 t= estobj5 testobj6 \ libmarkermod4-1 libmarkermod4-2 libmarkermod4-3 libmarkerm= od4-4 \ tst-tls20mod-bad tst-tls21mod tst-dlmopen-dlerror-mod \ tst-auxvalmod \ + tst-dlmopen-gethostbyname-mod \ # Most modules build with _ISOMAC defined, but those filtered out # depend on internal headers. @@ -1832,3 +1833,5 @@ $(objpfx)tst-tls21mod.so: $(tst-tls-many-dynamic-modu= les:%=3D$(objpfx)%.so) $(objpfx)tst-getauxval-static.out: $(objpfx)tst-auxvalmod.so tst-getauxval-static-ENV =3D LD_LIBRARY_PATH=3D$(objpfx):$(common-objpfx) + +$(objpfx)tst-dlmopen-gethostbyname.out: $(objpfx)tst-dlmopen-gethostbyname= -mod.so diff --git a/elf/dl-libc.c b/elf/dl-libc.c index 8e0734f44c..a49df22029 100644 --- a/elf/dl-libc.c +++ b/elf/dl-libc.c @@ -43,8 +43,8 @@ dlerror_run (void (*operate) (void *), void *args) const char *last_errstring =3D NULL; bool malloced; - int result =3D (_dl_catch_error (&objname, &last_errstring, &malloced, - operate, args) + int result =3D (GLRO (dl_catch_error) (&objname, &last_errstring, &mallo= ced, + operate, args) ?: last_errstring !=3D NULL); if (result && malloced) diff --git a/elf/tst-dlmopen-gethostbyname-mod.c b/elf/tst-dlmopen-gethostb= yname-mod.c new file mode 100644 index 0000000000..9a68ea5050 --- /dev/null +++ b/elf/tst-dlmopen-gethostbyname-mod.c @@ -0,0 +1,29 @@ +/* Exercise dlerror_run in elf/dl-libc.c after dlmopen, via NSS. Helper m= odule. + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include + +void +call_gethostbyname (void) +{ + __nss_configure_lookup ("hosts", "files"); + /* This should not terminate the process due to a missing + _nss_files_getcanonname_r symbol. */ + gethostbyname ("localhost"); +} diff --git a/elf/tst-dlmopen-gethostbyname.c b/elf/tst-dlmopen-gethostbynam= e.c new file mode 100644 index 0000000000..12deb29900 --- /dev/null +++ b/elf/tst-dlmopen-gethostbyname.c @@ -0,0 +1,31 @@ +/* Exercise dlerror_run in elf/dl-libc.c after dlmopen, via NSS (bug 27646= ). + Copyright (C) 2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +static int +do_test (void) +{ + void *handle =3D xdlmopen (LM_ID_NEWLM, "tst-dlmopen-gethostbyname-mod.s= o", + RTLD_NOW); + void (*call_gethostbyname) (void) =3D xdlsym (handle, "call_gethostbynam= e"); + call_gethostbyname (); + return 0; +} + +#include