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-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-5.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,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 9171F1F8C6 for ; Mon, 12 Jul 2021 14:08:54 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 82A573885C38 for ; Mon, 12 Jul 2021 14:08:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82A573885C38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626098933; bh=VLqd2mAu7Pr1wtw7ZiOw+jnyRSa+bIaN/R3PGBtwOn4=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=HmvfDcY94o47cADDKU4Hep4cFt6CFWAPtmG9aLmRfVyxMP0IxF3MBct3W6gKoNF3r UUU4oQ2BGYfy/Ps4UvblhcMk1k+iGPDB9r2wZiAJDxzyd0HerTULrlh05pWHt7AU18 KwPWUXUVyi7Y5CiG+dmO+aEA79mz6jqHJTYC/Rhs= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id E60963885C38 for ; Mon, 12 Jul 2021 14:08:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E60963885C38 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-43-UBc7KDEbP4CUlxTUq-lWiw-1; Mon, 12 Jul 2021 10:08:07 -0400 X-MC-Unique: UBc7KDEbP4CUlxTUq-lWiw-1 Received: by mail-qk1-f198.google.com with SMTP id g135-20020a379d8d0000b02903b5097f3998so14281534qke.14 for ; Mon, 12 Jul 2021 07:08:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=VLqd2mAu7Pr1wtw7ZiOw+jnyRSa+bIaN/R3PGBtwOn4=; b=Dmp345FCNHvqgsyAQRx70gmZHpWuKjdU/yVQ1WaM44IeXK/m+SxWxDKTiSBW48SpaW RuwlmGTVdrngxn2OvT60xmHCwpMMQ5d8VYyerUEmr3rpl6rhm4NBCo0Pudy7FbOjIdxf BBlDe19PzjKLz1hBOxVd7XbUYtS3glcpwH+4bV5MXvRv9QDFYoCKVAIg6EPXfseDuEYS 2PJ6EKGIzN7fQXIqYt9uzFeWVvAP7shSsW+LB6H7ZRXEfpvMzVbGbVeecLUjX88ZjYY2 89v/DhAJmvhZnUyvgOa4ZuyrHkKqg8Ud5fGWQ5jnZF6ObHu96OLoovfPtaFTZJUDqa3T wUKg== X-Gm-Message-State: AOAM5336lxQE4mjVkfYr7F+Jw/Rlm8wSsorsSG5SHkMwuOydIZcKe/+x zbCPNyuzpdV7VHVOzw8VO/JQhdtDUFEemdqC4hsr2ypRPcZh6MutuSQA7DjtRVmyJaDrDXMHNK7 C+e1t5KQsU0LfoJf9JtkB X-Received: by 2002:ac8:75c2:: with SMTP id z2mr17404144qtq.303.1626098887315; Mon, 12 Jul 2021 07:08:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6mRwIGvjKUWBSQnQQFIK37aFAnqFwK1ACELfyLFb3z34/mSMT6pLHjgkDXocgvWCmK/XN6Q== X-Received: by 2002:ac8:75c2:: with SMTP id z2mr17404132qtq.303.1626098887154; Mon, 12 Jul 2021 07:08:07 -0700 (PDT) Received: from [192.168.1.16] (198-84-214-74.cpe.teksavvy.com. [198.84.214.74]) by smtp.gmail.com with ESMTPSA id q206sm6590762qka.19.2021.07.12.07.08.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Jul 2021 07:08:06 -0700 (PDT) Subject: Re: [PATCH] csu: Skip ARCH_SETUP_IREL if _dl_relocate_static_pie applied IRELATIVE relocations [BZ #27164] To: Fangrui Song , libc-alpha@sourceware.org References: <20210708221032.955550-1-maskray@google.com> Organization: Red Hat Message-ID: <8b8fb5c9-ce4e-b10e-95b1-0281f96894c0@redhat.com> Date: Mon, 12 Jul 2021 10:08:05 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210708221032.955550-1-maskray@google.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: Carlos O'Donell via Libc-alpha Reply-To: Carlos O'Donell Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 7/8/21 6:10 PM, Fangrui Song wrote: > From: Siva Chandra Reddy > > For a static pie, _dl_relocate_static_pie applies IRELATIVE relocations > so ARCH_SETUP_IREL should not apply relocations again. The code > currently relies on ld -pie not defining > __rela_iplt_start/__rela_iplt_end (they end up as 0 as unresolved > undefined weak symbols). Correct, this is how PIE and static PIE were designed by HJ. > However, LLD defines __rela_iplt_start/__rela_iplt_end regardless of > -no-pie or -pie, so in an LLD linked static pie, ARCH_SETUP_IREL would > re-apply the relocations in the range of [__rela_iplt_start, > __rela_iplt_end), causing a segfault. The reason this issue has been raised is that our joint downstream users are unable to use lld on existing systems to compile and test static PIE binaries. Ryan Houdek raised it on IRC, and I asked them to file a bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28066 The average downstream users may take anywhere from 12-18 months to get a new glibc in their systems. If lld were to make the change today that would enable all downstream users to be able to use lld to compile static PIE without needing to get an updated glibc. >From such a perspective the lld change to match binutils enables the feature for the most number of users the fastest. > Change _dl_relocate_static_pie to return an int, indicating whether the > relocations have been applied. This makes the intention clearer and > makes glibc buildable with LLD>=9.0 if we allow LLD at configure time. > > In addition, this enables a future simplification to GNU ld: we can drop > a linker script difference between -no-pie and -pie. > > Co-authored-by: Fangrui Song I'm not inclined to accept this path. Not because I think the patch is technically wrong, but because fixing lld enables it immediately for the most number of users (making the patch moot). -- Cheers, Carlos.