From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id 92C7A38708E1 for ; Wed, 16 Dec 2020 13:33:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 92C7A38708E1 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0BGDVZ8d144480 for ; Wed, 16 Dec 2020 08:33:00 -0500 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 35fhkf378c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 16 Dec 2020 08:33:00 -0500 Received: from m0098413.ppops.net (m0098413.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0BGDVhLL145216 for ; Wed, 16 Dec 2020 08:32:59 -0500 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0b-001b2d01.pphosted.com with ESMTP id 35fhkf3785-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Dec 2020 08:32:59 -0500 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0BGDWqP9028016; Wed, 16 Dec 2020 13:32:59 GMT Received: from b03cxnp07029.gho.boulder.ibm.com (b03cxnp07029.gho.boulder.ibm.com [9.17.130.16]) by ppma03dal.us.ibm.com with ESMTP id 35cng9qv9u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 16 Dec 2020 13:32:58 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0BGDWvm025493906 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 Dec 2020 13:32:57 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB34178066; Wed, 16 Dec 2020 13:32:57 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC5707805E; Wed, 16 Dec 2020 13:32:56 +0000 (GMT) Received: from [9.160.125.175] (unknown [9.160.125.175]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Wed, 16 Dec 2020 13:32:56 +0000 (GMT) Subject: Re: [PATCH] elf: Record libc.so link map when it is the main program (bug 20972) To: Florian Weimer , libc-alpha@sourceware.org References: <878s9z9w0d.fsf@oldenburg2.str.redhat.com> From: Raphael M Zinsly Message-ID: <16364ceb-7ef2-5d0b-568b-5a66bbbb97d8@linux.ibm.com> Date: Wed, 16 Dec 2020 10:32:55 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <878s9z9w0d.fsf@oldenburg2.str.redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.343, 18.0.737 definitions=2020-12-16_05:2020-12-15, 2020-12-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 bulkscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 spamscore=0 clxscore=1015 malwarescore=0 impostorscore=0 mlxlogscore=999 phishscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012160086 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: Wed, 16 Dec 2020 13:33:01 -0000 The patch LGTM. And I agree with Carlos, running libc.so.6 as binary shouldn't be allowed. On 15/12/2020 07:57, Florian Weimer via Libc-alpha wrote: > Otherwise, it will not participate in the dependency sorting. > > Fixes commit 9ffa50b26b0cb5d3043adf6d3d0b1ea735acc147 > ("elf: Include libc.so.6 as main program in dependency sort > (bug 20972)"). > > --- > elf/rtld.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/elf/rtld.c b/elf/rtld.c > index 526360237f..38f11f5b73 100644 > --- a/elf/rtld.c > +++ b/elf/rtld.c > @@ -49,6 +49,7 @@ > #include > #include > #include > +#include > > #include > > @@ -1609,6 +1610,16 @@ dl_main (const ElfW(Phdr) *phdr, > { > /* Extract the contents of the dynamic section for easy access. */ > elf_get_dynamic_info (main_map, NULL); > + > + /* If the main map is libc.so, update the base namespace to > + refer to this map. If libc.so is loaded later, this happens > + in _dl_map_object_from_fd. */ > + if (main_map->l_info[DT_SONAME] != NULL > + && (strcmp (((const char *) D_PTR (main_map, l_info[DT_STRTAB]) > + + main_map->l_info[DT_SONAME]->d_un.d_val), LIBC_SO) > + == 0)) > + GL(dl_ns)[LM_ID_BASE].libc_map = main_map; > + > /* Set up our cache of pointers into the hash table. */ > _dl_setup_hash (main_map); > } > -- Raphael Moreira Zinsly IBM Linux on Power Toolchain