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 ESMTPS id E7B77385840D for ; Thu, 13 Jan 2022 17:56:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E7B77385840D Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-12-ZbUjEvPwOTi-RS9HAEjriQ-1; Thu, 13 Jan 2022 12:56:07 -0500 X-MC-Unique: ZbUjEvPwOTi-RS9HAEjriQ-1 Received: by mail-qv1-f71.google.com with SMTP id r2-20020a0562140c4200b00418e57a7b35so6467484qvj.3 for ; Thu, 13 Jan 2022 09:56:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=4hFnuAakgDzYQQcz09V14/HpC91Ty+cYOWk1Gi7sP18=; b=GQXMsAD+YY2+Ue6qELOLO+vBrefRJOiY9zO8+jYBAg2QcoykLOKJ2LXPtkg2+nEsAC 88ZDBmdOPd+AwQjsWQx/qdzWxk69ZNVqufYeH88SSzaufPQ0mohRefIUN+goy1+t54b3 wcHtXJ3eq0LNrBUcT0TdBiJNDfLEFOr8Sc59XjIJlBZxcbtLDdQ3gPovNPMV7I7BO49b IKXaRjHx2OTFS+Jd04qp6Vzc8dvOSvh0CyE8wqv3zJA0cEXPLaxFj+FpVwgxAVwYCz++ BCjZ9ul5JDoi6Zn3lWe6D8Sj+Afh17Lp9VgsfFc0yK5SDhFmbCEmv9y2shhqa5F13C8o prTg== X-Gm-Message-State: AOAM5306Rb0OnDXEugLouparkDwAVOIbLXTuiku3ywigwX4XA8YKi7Kg 5rlU1Q4LMWN8jUpaOYkkfqLV4h6cVta0dI+ntAckl0nFL6egsI1A1Ne2MfvUaxCIBmVBFmHdDgl inTjO4J+OlwTlUxb7cveO X-Received: by 2002:ac8:5c8e:: with SMTP id r14mr4561459qta.42.1642096566815; Thu, 13 Jan 2022 09:56:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJxdUi7uoxJOs5uupUIj0vhcRaUtefIFJXze1yG8fi6ErNGYsjt9inlK84Ea6Gy0RjwWtPhZ7w== X-Received: by 2002:ac8:5c8e:: with SMTP id r14mr4561453qta.42.1642096566623; Thu, 13 Jan 2022 09:56:06 -0800 (PST) Received: from [192.168.0.241] (135-23-175-80.cpe.pppoe.ca. [135.23.175.80]) by smtp.gmail.com with ESMTPSA id y17sm2542203qtj.75.2022.01.13.09.56.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Jan 2022 09:56:06 -0800 (PST) Message-ID: <6fe7c1a1-7c48-4a0f-4562-06ff9a13abe0@redhat.com> Date: Thu, 13 Jan 2022 12:56:03 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH] Fix glibc 2.34 ABI omission (missing GLIBC_2.34 in dynamic loader) To: Siddhesh Poyarekar , Florian Weimer Cc: libc-alpha@sourceware.org References: <87h7bjmnt0.fsf@oldenburg.str.redhat.com> <026b3d7a-7de3-3f7e-d59e-85fe7514eb54@gotplt.org> <874k7c1z20.fsf@oldenburg.str.redhat.com> <6af259d3-1123-5b5a-fe2b-7207d48e46af@gotplt.org> From: Carlos O'Donell Organization: Red Hat In-Reply-To: <6af259d3-1123-5b5a-fe2b-7207d48e46af@gotplt.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, URIBL_BLACK 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: Thu, 13 Jan 2022 17:56:13 -0000 On 12/13/21 09:54, Siddhesh Poyarekar wrote: > On 12/13/21 17:45, Florian Weimer wrote: >> It's only possible to move symbols if version nodes exist on both >> sides. Therefore, this patch adds a version node to ld.so. > > Could we enforce via a test that both libc.so and ld.so always have > the same version nodes? That'll give us future flexibility at the > cost of the extra few bytes. I agree this might be a nice addition to allow symbols to move between the objects. I wouldn't block this patch on such a belt-and-suspenders check, but I agree that checking if they have the same version notes would be useful. We haven't ever done this in the past. >> Without the version node, a binary linked against newer glibc will >> start referencing GLIBC_2.34 in ld.so after a symbol move to ld.so. >> The lazy > > Would it contain a reference to ld.so though? IIRC, the > symbol/version checks don't care about the DSO in which they are > found. So in old glibc, it should resolve to > pthread_key_create@GLIBC_2.34 in libc.so.6 and in newer glibc it > should resolve to pthread_key_create@GLIBC_2.34 in ld.so. They do care. Unfixed: LD_LIBRARY_PATH=. ./main-v2 ./main-v2: ./lib2.so: version `FIRST_1.0' not found (required by ./main-v2) ./main-v2: ./lib1.so: version `FIRST_1.1' not found (required by ./main-v2) - Loader looks to determine if version node is present in the referenced DSO. e.g. Version needs section '.gnu.version_r' contains 3 entries: Addr: 0x00000000004004f8 Offset: 0x0004f8 Link: 7 (.dynstr) 000000: Version: 1 File: lib2.so Cnt: 1 0x0010: Name: FIRST_1.0 Flags: none Version: 5 0x0020: Version: 1 File: lib1.so Cnt: 1 0x0030: Name: FIRST_1.1 Flags: none Version: 4 0x0040: Version: 1 File: libc.so.6 Cnt: 2 0x0050: Name: GLIBC_2.2.5 Flags: none Version: 3 0x0060: Name: GLIBC_2.34 Flags: none Version: 2 Fixed: LD_LIBRARY_PATH=. ./main-v2 first = 0, second = 42 - Loader finds both version nodes in the bound library. While the symbol@version can move, if the version node is missing you still get a diagnostic, and that forces you to add a completely new version, when all you did was move the existing version. There are two kinds of checks: - Does my DSO contain the version nodes I expected? - Does a DSO contain the symbol@version I expected? We never relaxed the version node check because it's a useful first pass check. We've always been moving symbols for which the target DSO had the same version node. -- Cheers, Carlos.