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 608D3385840C for ; Mon, 29 May 2023 20:09:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 608D3385840C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685390976; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dsG3QU5+YOUS1Ze/UMEtlXPqzwqN2dxI7LBgblqkpK4=; b=e/SdI+ALka4R5XPNWAaatZFGkzguvlGolj1fyxdkLQb01nVbaR2xhAaH0HF5XZ+Y7iiqRd HI+khS8xLCa9T8/dge8WFbRCuUK+ppvJz4fTSQ1EpZ6N8CMEcWXQRRzdviUJhcMQDwfBtE +YBlT/vCEqpNC1uaWkY30r/M3z6glng= Received: from mail-yw1-f199.google.com (mail-yw1-f199.google.com [209.85.128.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-134-3Z6i38NJNMqo4ac1i9PxnQ-1; Mon, 29 May 2023 16:09:34 -0400 X-MC-Unique: 3Z6i38NJNMqo4ac1i9PxnQ-1 Received: by mail-yw1-f199.google.com with SMTP id 00721157ae682-5651d8acfe2so81516627b3.2 for ; Mon, 29 May 2023 13:09:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685390974; x=1687982974; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dsG3QU5+YOUS1Ze/UMEtlXPqzwqN2dxI7LBgblqkpK4=; b=kj01tiDxsaqpSKWwH4Bxa6MEs6a0CI4jcYYlZCMkHOQVr4wysXpCMBByL/geFI9IN5 YXvn9onMEysqNtiVlHjBuCLbQEj23qOwJsIYRT+kC3mzjZvSuHj7KeLeDHt1Jfiyc+0R p6yyKLX4IqPEfNaSLBiydHZ+K5ucll3V2TzPcfIbIPSzt0aepClQtbQSWB+xxICEeyXc 4fctfDWk6HW/QlLJ49QIdHn5aG2kZHtuxIbPUNFRQYlO3XZR7pSr3cFrORGpko4uFy0/ 4c7xXeSzcAQVIdUBxYIxhveQ4jJBlYN9rvVR/VWAseEPTtFfExC+U1AAGxbzCdxE7rqS oSdw== X-Gm-Message-State: AC+VfDwdth2Pmv6CV6pPGlewIo+j1KQ4vfdx9wI6HMBakcRfBN2iELMx XMD4c3HgJSIVR32REuR83sJFU9k7ZyN3mbN46se/j63/fJ/SRV6anJZW891pZaRj/gU9ydkYfGf +xc83YjUbGme2VZaaDdxE X-Received: by 2002:a0d:e806:0:b0:568:90a3:404b with SMTP id r6-20020a0de806000000b0056890a3404bmr3967543ywe.24.1685390973798; Mon, 29 May 2023 13:09:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6GYXI/a8vYgzuv/zvrq563dP6MPWsq5TgQCYTRx27cfKdg1ecQTE5fdHi68qMYzKlRoZH11A== X-Received: by 2002:a0d:e806:0:b0:568:90a3:404b with SMTP id r6-20020a0de806000000b0056890a3404bmr3967526ywe.24.1685390973510; Mon, 29 May 2023 13:09:33 -0700 (PDT) Received: from [192.168.0.241] ([198.48.244.52]) by smtp.gmail.com with ESMTPSA id x7-20020a816307000000b0055d8ce6d686sm3896831ywb.1.2023.05.29.13.09.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 May 2023 13:09:33 -0700 (PDT) Message-ID: Date: Mon, 29 May 2023 16:09:32 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2] elf: Make more functions available for binding during dlclose (bug 30425) To: Florian Weimer Cc: libc-alpha@sourceware.org References: <87mt1w4n54.fsf@oldenburg3.str.redhat.com> <87wn0wi63b.fsf@oldenburg.str.redhat.com> From: Carlos O'Donell Organization: Red Hat In-Reply-To: <87wn0wi63b.fsf@oldenburg.str.redhat.com> 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=-6.8 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_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 5/25/23 15:06, Florian Weimer wrote: > * Carlos O'Donell: > >> On 5/22/23 07:32, Florian Weimer via Libc-alpha wrote: >>> Previously, after destructors for a DSO have been invoked, ld.so refused >>> to bind against that DSO in all cases. Relax this restriction somewhat >>> if the referencing object is itself a DSO that is being unloaded. This >>> assumes that the symbol reference is not going to be stored anywhere. >> >> The truth here is that the example has a circular reference due to the >> interposition which makes it have an undefined load and unload >> order. You wrote a very specific test that *avoids* needing anything >> from mod1 during mod2's initialization. > > It's possible to create this situation with C++ code due to vague > linkage. No explicit interposition is needed. I didn't want to > incorporate the C++ test case because it's brittle: it depends on which > functions the compiler emits. (It has some leeway because of vague > linkage.) I agree that if the test is brittle we should just use what you have. Don't get me wrong, I think the test you wrote is a *good* test in that you are trying to exercise a scenario that should work in a consistent fashion. We should be breaking the circular dependencies in a consistent fashion. >> Having said all that we should *choose* an unload order that is the >> opposite of the load order and make it consistent, and if we could >> load it we should not fail to unload it because of a limitation of the >> dynamic loader. We might still fail due to some logical dependency in >> user code though. >> >> The DT_NEEDED in mod1 ensures we load: mod2 then mod1. The closing of >> mod1 should unload: mod1 then mod2 (opposite order). >> >> This consistent order should make it easier for users to debug other >> problems in their library designs. > > Yeah, sure? But that's how it's always been? Except that with bug 30425 it isn't? It crashes? You fixed it! :-) >>> The situation in the test case can arise fairly easily with C++ and >>> objects that are built with different optimization levels and therefore >>> define different functions with vague linkage. >> >> Please post a v3. > > With the comment updates? Or some other changes? My apologies, let me be more specific. During review I called out the following things: - Why do we need '__attribute__ ((weak))'? Needs comment. - Comment update suggestion in mod1 test case. - Net new comment in test case to explain expectations. Would you be able to address those for v3? -- Cheers, Carlos.