public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
Cc: "libc-alpha\@sourceware.org" <libc-alpha@sourceware.org>,
	 "carlos\@redhat.com" <carlos@redhat.com>,
	 "gnugerrit\@kalvdans.no-ip.org" <gnugerrit@kalvdans.no-ip.org>,
	   nd <nd@arm.com>
Subject: Re: [pushed] Remove all loaded objects if dlopen fails, ignoring NODELETE [BZ #20839]
Date: Mon, 02 Dec 2019 12:17:00 -0000	[thread overview]
Message-ID: <87h82izzun.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <d7204959-36b4-ef4b-db4e-9c4c9b86b035@arm.com> (Szabolcs Nagy's message of "Mon, 2 Dec 2019 10:06:51 +0000")

* 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?

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

Thanks,
Florian

  reply	other threads:[~2019-12-02 12:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31 19:21 [review] " Florian Weimer (Code Review)
2019-10-31 20:18 ` Christian Häggström (Code Review)
2019-11-13 12:56 ` [review v2] " Florian Weimer (Code Review)
2019-11-13 14:28 ` Christian Häggström (Code Review)
2019-11-15 16:02 ` [review v3] " Florian Weimer (Code Review)
2019-12-02 16:07   ` Florian Weimer
2019-12-02 16:53     ` Carlos O'Donell
2019-11-21 12:57 ` Carlos O'Donell (Code Review)
2019-11-27 20:31 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-12-02 10:07   ` Szabolcs Nagy
2019-12-02 12:17     ` Florian Weimer [this message]
2019-12-02 13:52       ` Szabolcs Nagy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h82izzun.fsf@oldenburg2.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=Szabolcs.Nagy@arm.com \
    --cc=carlos@redhat.com \
    --cc=gnugerrit@kalvdans.no-ip.org \
    --cc=libc-alpha@sourceware.org \
    --cc=nd@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).