From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id C3BB83858401 for ; Fri, 17 Sep 2021 08:37:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C3BB83858401 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-132-7ShMC_rMMyCSUOe02ntWyg-1; Fri, 17 Sep 2021 04:37:41 -0400 X-MC-Unique: 7ShMC_rMMyCSUOe02ntWyg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 07A89802928; Fri, 17 Sep 2021 08:37:40 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.16]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5A1376CA20; Fri, 17 Sep 2021 08:37:38 +0000 (UTC) From: Florian Weimer To: Richard Biener Cc: Richard Biener via Gcc , Joseph Myers , GNU C Library , libc-coord@lists.openwall.com Subject: Re: [libc-coord] Add new ABI '__memcmpeq()' to libc References: <87y27vhbel.fsf@oldenburg.str.redhat.com> Date: Fri, 17 Sep 2021 10:37:36 +0200 In-Reply-To: (Richard Biener's message of "Fri, 17 Sep 2021 10:31:54 +0200") Message-ID: <87lf3vha27.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Fri, 17 Sep 2021 08:37:45 -0000 * Richard Biener: > On Fri, Sep 17, 2021 at 10:08 AM Florian Weimer wrote: >> >> * Richard Biener via Gcc: >> >> > On Thu, Sep 16, 2021 at 10:36 PM Joseph Myers wrote: >> >> >> >> On Thu, 16 Sep 2021, Chris Kennelly wrote: >> >> >> >> > In terms of relying on the feature: If __memcmpeq is ever exposed as an a >> >> > simple alias for memcmp (since the notes mention that it's a valid >> >> > implementation), does that open up the possibility of depending on the >> >> > bcmp-like behavior that we were trying to escape? >> >> >> >> The proposal is as an ABI only (compilers would generate calls to >> >> __memcmpeq from boolean uses of memcmp, users wouldn't write calls to >> >> __memcmpeq directly, __memcmpeq wouldn't be declared in installed libc >> >> headers). If such dependence arises, that would suggest a compiler bug >> >> wrongly generating such calls for non-boolean memcmp uses. >> > >> > So the compiler would emit a call to __memcmpeq and at the same time >> > emit a weak alias of __memcmpeq to memcmp so the program links >> > when the libc version targeted does not provide __memcmpeq? Or would >> > glibc through magically communicate the availability of the new ABI >> > without actually declaring the function? >> >> I do not think ELF provides that capability. > > I guess a weak forwarder should do the trick at the cost of a jmp. How would this look like in practice. The GNU tools do not support weak symbol versions, so if you have a weak reference to __memcmpeq@GLIBC_2.35, that's still a reference to the GLIBC_2.35 symbol version. The glibc 2.34 dynamic loader notes that version and rejects the binary because GLIBC_2.35 does not exist. (We should probably stop Cc:ing libc-coord because this is so very GNU-specific at this point.) Thanks, Florian