From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id AC0F33850434 for ; Tue, 8 Dec 2020 14:11:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AC0F33850434 Received: by mail-ot1-x32e.google.com with SMTP id a109so280836otc.1 for ; Tue, 08 Dec 2020 06:11:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QQCBGe+184dyLT4hOUuUdc4WTaUfnAIssiMuwBKFyAA=; b=EHikwhVR6686CTMKSBfKVk8m8PoACMCZCEjuSDOnZkBuX4r6MEcl5CLIYI+SMOTvlm DrjXY45zMp1xuFl6JrEWMq1m62rgkED2UKvWDy0KeXWjGiB6rUOtPFLQAL3kOT0aaE6L tKgnsNBItQ/F7PZRI6KXrdDd1ly8ByruYvr6UOHCJGyCY2SR9ilrZFnZCEBCHLqMHhEZ yvjfJsqZkPDS4VY8aMkGF05mD+dmQubLAi1V0KAZyJQFrWTTOrty2yFUmmTyALnro846 KcBRBpLhsIpbnCwf7+4d5SOf9osU4/GQYAKqSSU3PrHOsiI2OZCKSRFtTIXJKQUspa1K eDqw== X-Gm-Message-State: AOAM532KKeS/FAn/7by0qDILNQ7L+yWKVcEEOZPK5Mm+aZKJGFjCqdWJ 7mHWb2pO5nSk6sZSIpdyrgxuJqHdDnYOtBQBUGE= X-Google-Smtp-Source: ABdhPJxi6IXcVVvWyIJqaCLLk4nwX1912ieM9duWGvwbojZlMs9JjbYcaukFuRJ93SmUyaTvkuvKx3cg4ARqp0uIri0= X-Received: by 2002:a05:6830:1d71:: with SMTP id l17mr285544oti.269.1607436674946; Tue, 08 Dec 2020 06:11:14 -0800 (PST) MIME-Version: 1.0 References: <20201206144952.2109594-1-hjl.tools@gmail.com> <20201206144952.2109594-3-hjl.tools@gmail.com> <87sg8ikkal.fsf@oldenburg2.str.redhat.com> <871rg0e85j.fsf@oldenburg2.str.redhat.com> In-Reply-To: <871rg0e85j.fsf@oldenburg2.str.redhat.com> From: "H.J. Lu" Date: Tue, 8 Dec 2020 06:10:38 -0800 Message-ID: Subject: Re: V5 [PATCH 2/2] ldconfig/x86: Add ISA level check to glibc-hwcaps To: Florian Weimer Cc: "H.J. Lu via Libc-alpha" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3031.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, 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 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: Tue, 08 Dec 2020 14:11:19 -0000 On Tue, Dec 8, 2020 at 5:32 AM Florian Weimer wrote: > > * H. J. Lu: > > > On Mon, Dec 7, 2020 at 2:00 AM Florian Weimer wrote: > >> > >> * H. J. Lu via Libc-alpha: > >> > >> > Add ISA level check to detect misplaced shared objects with incompatible > >> > ISA level requirement in glibc-hwcaps subdirectories: > >> > > >> > /sbin/ldconfig: /usr/lib64/glibc-hwcaps/x86-64-v2/libx86-64-isa-level.so: skipped, ISA level mismatch (x86-64-v4 > x86-64-v2) > >> > >> I think this is conceptually the wrong approach. ldconfig should copy > >> the notes into the cache (and aux cache), and ld.so should skip cache > >> contents that doesn't match the run-time requirements during load. Then > >> directory place does not matter that much anymore. > > > > Do we have space in cache for it? > > We have an extension mechanism. The relevant struct looks like this: > > struct file_entry_new > { > int32_t flags; /* This is 1 for an ELF library. */ > uint32_t key, value; /* String table indices. */ > uint32_t osversion; /* Required OS version. */ > uint64_t hwcap; /* Hwcap entry. */ > }; > > We can set a previously-unused bit hwcap to hide entries from current > ld.so. This way, we can repurpose other hwcap bits, osversion, even > flags. We could put an index there into a array of (property) notes, > and use deduplication to share identical notes from different shared > objects. > > In essence, this is how the glibc-hwcaps subdirectory mechanism achieves > backwards-compatibility. > For each file entry for a shared object, the hwcap field has been used by DL_CACHE_HWCAP_EXTENSION for glibc-hwcaps. Are you suggesting to add another file entry for the same shared object to store ISA level requirement? -- H.J.