This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] nss_files: Fix /etc/aliases null pointer dereference [BZ #24059]
- From: Florian Weimer <fweimer at redhat dot com>
- To: Szabolcs Nagy <nsz at port70 dot net>
- Cc: Szabolcs Nagy <Szabolcs dot Nagy at arm dot com>, nd <nd at arm dot com>, "libc-alpha\@sourceware.org" <libc-alpha at sourceware dot org>
- Date: Wed, 13 Mar 2019 17:36:33 +0100
- Subject: Re: [PATCH] nss_files: Fix /etc/aliases null pointer dereference [BZ #24059]
- References: <87a7k1531v.fsf@oldenburg2.str.redhat.com> <723b2509-9df4-315e-6e02-18be9d1beb42@arm.com> <874l9na6as.fsf@oldenburg2.str.redhat.com> <ce1dd533-a737-19f6-7fb5-1eadfea121b9@arm.com> <87ef8r8leg.fsf@oldenburg2.str.redhat.com> <20190202160154.GL21289@port70.net>
* Szabolcs Nagy:
> * Florian Weimer <fweimer@redhat.com> [2019-02-01 18:32:23 +0100]:
>> * Szabolcs Nagy:
>> >
>> > libnss_files.so.2 is not listed as explicit dependency
>> > for some reason so it is not loaded at program startup,
>> > but after chroot is entered, but it's not available in
>> > the chroot so the first api call fails.
>>
>> There's already this in nss/Makefile:
>>
>> $(objpfx)tst-nss-files-alias-truncated: $(objpfx)/libnss_files.so
>>
>> I expected this causes a DT_NEEDED entry to be added to the executable,
>> so it is loaded upon startup, outside of the chroot.
>
> it seems debian/ubuntu gcc always passes --as-needed to the linker
> https://wiki.debian.org/ToolChain/DSOLinking
>
> so either a reference is needed to the lib or
> -Wl,--no-as-needed lib -Wl,--as-needed
> ldflag to force a DT_NEEDED.
>
> ..or copy the lib to the chroot.
So what should we do here?
Should we disable --as-needed across the board? Or should we fix the
test?
Thanks,
Florian