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=-4.3 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham 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 DFF421F4B4 for ; Thu, 1 Oct 2020 18:22:44 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C73193985476; Thu, 1 Oct 2020 18:22:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C73193985476 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1601576563; bh=2bKW1bAJxJ/9KOO0UMoy+UMlUY9PqEjowjb3MerBVKk=; h=To:References:Subject:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=yfcsLmXCwY5SPd1oSYEOafHqRTvhXgs9PLIv55OkKbIzBlkhvJ/qqr0VkFO+3afPF PColZdwNbk6xGyfjRHxsbAzN0pkagYTWHXXAloW3gV8Fcu4E99uV54wgtSoWFXfmRj o/qZmMkWQ0mWt77o7pS0qHon1WaPAnJr+eRoiRcU= Received: from mail-qt1-x843.google.com (mail-qt1-x843.google.com [IPv6:2607:f8b0:4864:20::843]) by sourceware.org (Postfix) with ESMTPS id D4903386EC42 for ; Thu, 1 Oct 2020 18:22:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D4903386EC42 Received: by mail-qt1-x843.google.com with SMTP id a4so5418460qth.0 for ; Thu, 01 Oct 2020 11:22:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:references:from:autocrypt:subject:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=2bKW1bAJxJ/9KOO0UMoy+UMlUY9PqEjowjb3MerBVKk=; b=c+jpV8rVefWkrSQf42lv+WobCgbdT01Bj8ohB6MQki/jQZY7PgKoMco/+ExbehbWEL G0vpmyUx0TLOd+iyMnZLvobulnjhEnZMHm56ngpzYg2GvugASrZHaJgulKQAbi7in8BA NX5Lq8ZUicshqfHbonkuIo/JzyZq4Me3tihO/FwwnGTGdezuoD1AuWr8MDravtwyJe8B EWIbY6PfE4bg/COkkONtwzmSwXLnGKL3OJ8PPObbptr9qxECYs3XZ9Mi9aOQN1gOCJe1 zYCdW5yXAoRC/LvJJCI/hNyheloOmr5WOguv/eUaYJCyA1f077Q1/5Idvrho2xex52z/ cNUQ== X-Gm-Message-State: AOAM533M7O9crcBrpQ2whEjxl94++6/JiJm8ub23YxzCSf36k2xOjEXE OjdW/faDkpGdqrLax+2LBYdewFLHHzhS0A== X-Google-Smtp-Source: ABdhPJxUVFvisIA6EIThCoUPJijidiukMUSdJVoh8/sxWtjHozeTCxIlg+Jb2VaWkfPh+1U+Gu2Vng== X-Received: by 2002:ac8:5d04:: with SMTP id f4mr9018471qtx.290.1601576559165; Thu, 01 Oct 2020 11:22:39 -0700 (PDT) Received: from [192.168.1.4] ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id f13sm5952620qko.122.2020.10.01.11.22.37 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 01 Oct 2020 11:22:38 -0700 (PDT) To: libc-alpha@sourceware.org References: <75fdede6bc2db8a3638c1402855b2c5245f4b545.1601569371.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WIXuZ yv0XYxf1WF6dRizwFFbxvUZzIJp3spAao7jLsQj1DbD2s5+S1BW09A0mI/1DjB6EhNN+4bDB SJCOv/ReK3tFJXuj/HbyDrOdoMt8aIFbe7YFLEExHpSk+HgN05Lg5TyTro8oW7TSMTk+8a5M kzaH4UGXTTBDP/g5cfL3RFPl79ubXwARAQABiQIfBBgBCAAJBQJXFRpKAhsMAAoJEKqx7BSn lIjvI/8P/jg0jl4Tbvg3B5kT6PxJOXHYu9OoyaHLcay6Cd+ZrOd1VQQCbOcgLFbf4Yr+rE9l mYsY67AUgq2QKmVVbn9pjvGsEaz8UmfDnz5epUhDxC6yRRvY4hreMXZhPZ1pbMa6A0a/WOSt AgFj5V6Z4dXGTM/lNManr0HjXxbUYv2WfbNt3/07Db9T+GZkpUotC6iknsTA4rJi6u2ls0W9 1UIvW4o01vb4nZRCj4rni0g6eWoQCGoVDk/xFfy7ZliR5B+3Z3EWRJcQskip/QAHjbLa3pml xAZ484fVxgeESOoaeC9TiBIp0NfH8akWOI0HpBCiBD5xaCTvR7ujUWMvhsX2n881r/hNlR9g fcE6q00qHSPAEgGr1bnFv74/1vbKtjeXLCcRKk3Ulw0bY1OoDxWQr86T2fZGJ/HIZuVVBf3+ gaYJF92GXFynHnea14nFFuFgOni0Mi1zDxYH/8yGGBXvo14KWd8JOW0NJPaCDFJkdS5hu0VY 7vJwKcyHJGxsCLU+Et0mryX8qZwqibJIzu7kUJQdQDljbRPDFd/xmGUFCQiQAncSilYOcxNU EMVCXPAQTteqkvA+gNqSaK1NM9tY0eQ4iJpo+aoX8HAcn4sZzt2pfUB9vQMTBJ2d4+m/qO6+ cFTAceXmIoFsN8+gFN3i8Is3u12u8xGudcBPvpoy4OoG Subject: Re: [PATCH 01/28] elf: Do not search HWCAP subdirectories in statically linked binaries Message-ID: <95b87318-0def-df24-d05d-1360f9857e9d@linaro.org> Date: Thu, 1 Oct 2020 15:22:35 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <75fdede6bc2db8a3638c1402855b2c5245f4b545.1601569371.git.fweimer@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit 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: Adhemerval Zanella via Libc-alpha Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On 01/10/2020 13:31, Florian Weimer via Libc-alpha wrote: > This functionality does not seem to be useful since static dlopen > is mostly used for iconv/character set conversion and NSS support. > gconv modules are loaded with full paths anyway, so that the > HWCAP subdirectory logic does not apply. This change looks reasonable, although it makes the semantic of statically linked programs slight different than dynamic one regarding dlopen. Reviewed-by: Adhemerval Zanella > --- > NEWS | 4 ++++ > elf/Makefile | 4 ++-- > elf/dl-load.c | 14 ++++++++++++++ > 3 files changed, 20 insertions(+), 2 deletions(-) > > diff --git a/NEWS b/NEWS > index ce05d05b16..902fa3a7f8 100644 > --- a/NEWS > +++ b/NEWS > @@ -33,6 +33,10 @@ Deprecated and removed features, and other changes affecting compatibility: > * The mallinfo function is marked deprecated. Callers should call > mallinfo2 instead. > > +* When dlopen is used in statically linked programs, alternative library > + implementations from HWCAP subdirectories are no longer loaded. > + Instead, the default implementation is used. > + > Changes to build and runtime requirements: > > [Add changes to build and runtime requirements here] Ok. > diff --git a/elf/Makefile b/elf/Makefile > index c587e9f06e..e0a8bf2998 100644 > --- a/elf/Makefile > +++ b/elf/Makefile > @@ -29,7 +29,7 @@ routines = $(all-dl-routines) dl-support dl-iteratephdr \ > > # The core dynamic linking functions are in libc for the static and > # profiled libraries. > -dl-routines = $(addprefix dl-,load lookup object reloc deps hwcaps \ > +dl-routines = $(addprefix dl-,load lookup object reloc deps \ > runtime init fini debug misc \ > version profile tls origin scope \ > execstack open close trampoline \ Ok. > @@ -59,7 +59,7 @@ elide-routines.os = $(all-dl-routines) dl-support enbl-secure dl-origin \ > # ld.so uses those routines, plus some special stuff for being the program > # interpreter and operating independent of libc. > rtld-routines = rtld $(all-dl-routines) dl-sysdep dl-environ dl-minimal \ > - dl-error-minimal dl-conflict > + dl-error-minimal dl-conflict dl-hwcaps > all-rtld-routines = $(rtld-routines) $(sysdep-rtld-routines) > > CFLAGS-dl-runtime.c += -fexceptions -fasynchronous-unwind-tables Ok. > diff --git a/elf/dl-load.c b/elf/dl-load.c > index 646c5dca40..5ba117d597 100644 > --- a/elf/dl-load.c > +++ b/elf/dl-load.c > @@ -101,9 +101,13 @@ int __stack_prot attribute_hidden attribute_relro > static struct r_search_path_struct env_path_list attribute_relro; > > /* List of the hardware capabilities we might end up using. */ > +#ifdef SHARED > static const struct r_strlenpair *capstr attribute_relro; > static size_t ncapstr attribute_relro; > static size_t max_capstrlen attribute_relro; > +#else > +enum { ncapstr = 1, max_capstrlen = 0 }; > +#endif > > > /* Get the generated information about the trusted directories. Use Ok. > @@ -691,9 +695,11 @@ _dl_init_paths (const char *llp) > /* Fill in the information about the application's RPATH and the > directories addressed by the LD_LIBRARY_PATH environment variable. */ > > +#ifdef SHARED > /* Get the capabilities. */ > capstr = _dl_important_hwcaps (GLRO(dl_platform), GLRO(dl_platformlen), > &ncapstr, &max_capstrlen); > +#endif > > /* First set up the rest of the default search directory entries. */ > aelem = rtld_search_dirs.dirs = (struct r_search_path_elem **) > @@ -1521,11 +1527,15 @@ print_search_path (struct r_search_path_elem **list, > for (cnt = 0; cnt < ncapstr; ++cnt) > if ((*list)->status[cnt] != nonexisting) > { > +#ifdef SHARED > char *cp = __mempcpy (endp, capstr[cnt].str, capstr[cnt].len); > if (cp == buf || (cp == buf + 1 && buf[0] == '/')) > cp[0] = '\0'; > else > cp[-1] = '\0'; > +#else > + *endp = '\0'; > +#endif > > _dl_debug_printf_c (first ? "%s" : ":%s", buf); > first = 0; > @@ -1886,11 +1896,15 @@ open_path (const char *name, size_t namelen, int mode, > if (this_dir->status[cnt] == nonexisting) > continue; > > +#ifdef SHARED > buflen = > ((char *) __mempcpy (__mempcpy (edp, capstr[cnt].str, > capstr[cnt].len), > name, namelen) > - buf); > +#else > + buflen = (char *) __mempcpy (edp, name, namelen) - buf; > +#endif > > /* Print name we try if this is wanted. */ > if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) > Ok.