From patchwork Mon Dec 2 12:17:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 36421 Received: (qmail 130398 invoked by alias); 2 Dec 2019 12:17:19 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 130390 invoked by uid 89); 2 Dec 2019 12:17:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy=H*f:sk:d720495, H*i:sk:d720495, defaults X-HELO: us-smtp-delivery-1.mimecast.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575289033; 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=sar/gmb6tEEfZ340dDEmPdNLWKJaOVUKgTF1wBMcaDU=; b=DckyyM42pRxX55ERVw18V+blpkPgUTTZjrBQ7hntARH1dXaxcUcLme4y80bkX4fQuWsZhE /KfZnxr/ASYzIBEQWAtguI/7PIpEGR9sx31zc3mBvNrLTXgIt8ULDrW6hA5sIWx/QOll4u IcP7InCBfhZUTwMEvVbDL16K3BVZong= From: Florian Weimer To: Szabolcs Nagy Cc: "libc-alpha\@sourceware.org" , "carlos\@redhat.com" , "gnugerrit\@kalvdans.no-ip.org" , nd Subject: Re: [pushed] Remove all loaded objects if dlopen fails, ignoring NODELETE [BZ #20839] References: <20191127203045.0D46E20AF6@gnutoolchain-gerrit.osci.io> Date: Mon, 02 Dec 2019 13:17:04 +0100 In-Reply-To: (Szabolcs Nagy's message of "Mon, 2 Dec 2019 10:06:51 +0000") Message-ID: <87h82izzun.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 * Szabolcs Nagy: > On 27/11/2019 20:30, Sourceware to Gerrit sync (Code Review) wrote: >> Sourceware to Gerrit sync has submitted this change. >> >> Change URL: https://gnutoolchain-gerrit.osci.io/r/c/glibc/+/471 >> ...................................................................... >> >> Remove all loaded objects if dlopen fails, ignoring NODELETE [BZ #20839] >> >> This introduces a “pending NODELETE” state in the link map, which is >> flipped to the persistent NODELETE state late in dlopen, via >> activate_nodelete. During initial relocation, symbol binding >> records pending NODELETE state only. dlclose ignores pending NODELETE >> state. Taken together, this results that a partially completed dlopen >> is rolled back completely because new NODELETE mappings are unloaded. >> >> Tested on x86_64-linux-gnu and i386-linux-gnu. >> >> Change-Id: Ib2a3d86af6f92d75baca65431d74783ee0dbc292 >> --- >> M elf/Makefile >> M elf/dl-close.c >> M elf/dl-lookup.c >> M elf/dl-open.c >> M elf/get-dynamic-info.h >> A elf/tst-dlopenfail.c >> A elf/tst-dlopenfaillinkmod.c >> A elf/tst-dlopenfailmod1.c >> A elf/tst-dlopenfailmod2.c >> M include/link.h >> 10 files changed, 328 insertions(+), 38 deletions(-) >> >> Approvals: >> Carlos O'Donell: Looks good to me, approved > > i see > > FAIL: elf/tst-dlopenfail > > and > > $ cat elf/tst-dlopenfail.out > info: attempting to load tst-dlopenfailmod1.so > tst-dlopenfailmod1 constructor executed > > on the aarch64 buildbot It's likely that your toolchain defaults to --no-as-needed. Does this patch fix things for you? Thanks, Florian diff --git a/elf/Makefile b/elf/Makefile index f825354d3f..0debea7759 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -1618,8 +1618,11 @@ LDFLAGS-tst-finilazyfailmod.so = \ $(objpfx)tst-dlopenfail: $(libdl) $(objpfx)tst-dlopenfail.out: \ $(objpfx)tst-dlopenfailmod1.so $(objpfx)tst-dlopenfailmod2.so -# Order matters here. tst-dlopenfaillinkmod.so's soname ensures -# a run-time loader failure. +# Order matters here. tst-dlopenfaillinkmod.so's soname ensures a +# run-time loader failure. --as-needed breaks this test because +# nothing actually references tst-dlopenfailmod2.so (with its soname +# tst-dlopenfail-missingmod.so). +LDFLAGS-tst-dlopenfailmod1.so = -Wl,--no-as-needed $(objpfx)tst-dlopenfailmod1.so: \ $(shared-thread-library) $(objpfx)tst-dlopenfaillinkmod.so LDFLAGS-tst-dlopenfaillinkmod.so = -Wl,-soname,tst-dlopenfail-missingmod.so