diff mbox series

libnsl: Turn remaining symbols into compat symbols [BZ #22701]

Message ID 20180111150450.56D6B40231FB5@oldenburg.str.redhat.com
State New
Headers show
Series libnsl: Turn remaining symbols into compat symbols [BZ #22701] | expand

Commit Message

Florian Weimer Jan. 11, 2018, 3:04 p.m. UTC
2018-01-11  Florian Weimer  <fweimer@redhat.com>

	[BZ #22701]
	* include/rpcsvc/nislib.h (__nis_default_ttl): Add
	libnsl_hidden_proto.
	* include/rpcsvc/yp.h (yp_xdrall): Declare with
	libnsl_hidden_proto.
	* include/rpcsvc/ypclnt.h (yp_maplist): Likewise.
	* nis/Makefile (libnsl-routines): Add nss-default only for
	build-obsolete-nsl.
	* nis/nis_defaults.c (__nis_default_ttl): Add
	libnsl_hidden_nolink_def.
	* nis/rpcsvc/ypclnt.h (yp_maplist): Remove #ifdef'ed-out
	declaration.
	* nis/yp_xdr.c (xdr_ypall): Add libnsl_hidden_nolink_def.
	* nis/ypclnt.c (yp_maplist): Likewise.

Comments

Andreas Schwab Jan. 29, 2018, 1:30 p.m. UTC | #1
On Jan 11 2018, fweimer@redhat.com (Florian Weimer) wrote:

> 	[BZ #22701]
> 	* include/rpcsvc/nislib.h (__nis_default_ttl): Add
> 	libnsl_hidden_proto.
> 	* include/rpcsvc/yp.h (yp_xdrall): Declare with
> 	libnsl_hidden_proto.
> 	* include/rpcsvc/ypclnt.h (yp_maplist): Likewise.
> 	* nis/Makefile (libnsl-routines): Add nss-default only for
> 	build-obsolete-nsl.
> 	* nis/nis_defaults.c (__nis_default_ttl): Add
> 	libnsl_hidden_nolink_def.
> 	* nis/rpcsvc/ypclnt.h (yp_maplist): Remove #ifdef'ed-out
> 	declaration.
> 	* nis/yp_xdr.c (xdr_ypall): Add libnsl_hidden_nolink_def.
> 	* nis/ypclnt.c (yp_maplist): Likewise.

Ok.

Andreas.
Florian Weimer Jan. 29, 2018, 1:32 p.m. UTC | #2
On 01/29/2018 02:30 PM, Andreas Schwab wrote:
> On Jan 11 2018, fweimer@redhat.com (Florian Weimer) wrote:
> 
>> 	[BZ #22701]
>> 	* include/rpcsvc/nislib.h (__nis_default_ttl): Add
>> 	libnsl_hidden_proto.
>> 	* include/rpcsvc/yp.h (yp_xdrall): Declare with
>> 	libnsl_hidden_proto.
>> 	* include/rpcsvc/ypclnt.h (yp_maplist): Likewise.
>> 	* nis/Makefile (libnsl-routines): Add nss-default only for
>> 	build-obsolete-nsl.
>> 	* nis/nis_defaults.c (__nis_default_ttl): Add
>> 	libnsl_hidden_nolink_def.
>> 	* nis/rpcsvc/ypclnt.h (yp_maplist): Remove #ifdef'ed-out
>> 	declaration.
>> 	* nis/yp_xdr.c (xdr_ypall): Add libnsl_hidden_nolink_def.
>> 	* nis/ypclnt.c (yp_maplist): Likewise.
> 
> Ok.

Dmitry, is it okay to sneak this into glibc 2.27?  The change is mostly 
cosmetic; the important change was not installing libnsl.so and 
libnsl.a, and that is already on master.

Thanks,
Florian
Dmitry V. Levin Jan. 29, 2018, 3:57 p.m. UTC | #3
On Mon, Jan 29, 2018 at 02:32:56PM +0100, Florian Weimer wrote:
> On 01/29/2018 02:30 PM, Andreas Schwab wrote:
> > On Jan 11 2018, fweimer@redhat.com (Florian Weimer) wrote:
> > 
> >> 	[BZ #22701]
> >> 	* include/rpcsvc/nislib.h (__nis_default_ttl): Add
> >> 	libnsl_hidden_proto.
> >> 	* include/rpcsvc/yp.h (yp_xdrall): Declare with
> >> 	libnsl_hidden_proto.
> >> 	* include/rpcsvc/ypclnt.h (yp_maplist): Likewise.
> >> 	* nis/Makefile (libnsl-routines): Add nss-default only for
> >> 	build-obsolete-nsl.
> >> 	* nis/nis_defaults.c (__nis_default_ttl): Add
> >> 	libnsl_hidden_nolink_def.
> >> 	* nis/rpcsvc/ypclnt.h (yp_maplist): Remove #ifdef'ed-out
> >> 	declaration.
> >> 	* nis/yp_xdr.c (xdr_ypall): Add libnsl_hidden_nolink_def.
> >> 	* nis/ypclnt.c (yp_maplist): Likewise.
> > 
> > Ok.
> 
> Dmitry, is it okay to sneak this into glibc 2.27?  The change is mostly 
> cosmetic; the important change was not installing libnsl.so and 
> libnsl.a, and that is already on master.

Yes, I think this is OK for 2.27, although I would prefer if it was
committed last week.
Joseph Myers Jan. 30, 2018, 1:01 a.m. UTC | #4
I think this introduces test failures in the case where there is an 
installed libnss_nis but you're not using --enable-obsolete-nsl, if 
/etc/nsswitch.conf has "passwd: compat".

FAIL: nss/bug17079
FAIL: nss/tst-nss-getpwent

The output of make check for those tests shows (seen on Ubuntu 16.04): 
"relocation error: /lib/x86_64-linux-gnu/libnss_nis.so.2: symbol 
_nsl_default_nss version GLIBC_PRIVATE not defined in file libnsl.so.1 
with link time reference", for both those tests.

Ideally we'd isolate such tests from the host environment so they don't 
depend at all on what /etc/nsswitch.conf looks like and never use any NSS 
modules from the host environment, only ones newly built with glibc.  I 
don't know if there's any quick and simple fix, however.
H.J. Lu Jan. 30, 2018, 1:28 a.m. UTC | #5
On Mon, Jan 29, 2018 at 5:01 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> I think this introduces test failures in the case where there is an
> installed libnss_nis but you're not using --enable-obsolete-nsl, if
> /etc/nsswitch.conf has "passwd: compat".
>
> FAIL: nss/bug17079
> FAIL: nss/tst-nss-getpwent
>
> The output of make check for those tests shows (seen on Ubuntu 16.04):
> "relocation error: /lib/x86_64-linux-gnu/libnss_nis.so.2: symbol
> _nsl_default_nss version GLIBC_PRIVATE not defined in file libnsl.so.1
> with link time reference", for both those tests.

This is:

https://sourceware.org/bugzilla/show_bug.cgi?id=22530

Should I reopen it?

> Ideally we'd isolate such tests from the host environment so they don't
> depend at all on what /etc/nsswitch.conf looks like and never use any NSS
> modules from the host environment, only ones newly built with glibc.  I
> don't know if there's any quick and simple fix, however.
>

"make check" really shouldn't use the host environment.
Joseph Myers Jan. 30, 2018, 2:12 a.m. UTC | #6
On Mon, 29 Jan 2018, H.J. Lu wrote:

> On Mon, Jan 29, 2018 at 5:01 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> > I think this introduces test failures in the case where there is an
> > installed libnss_nis but you're not using --enable-obsolete-nsl, if
> > /etc/nsswitch.conf has "passwd: compat".
> >
> > FAIL: nss/bug17079
> > FAIL: nss/tst-nss-getpwent
> >
> > The output of make check for those tests shows (seen on Ubuntu 16.04):
> > "relocation error: /lib/x86_64-linux-gnu/libnss_nis.so.2: symbol
> > _nsl_default_nss version GLIBC_PRIVATE not defined in file libnsl.so.1
> > with link time reference", for both those tests.
> 
> This is:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=22530
> 
> Should I reopen it?

No, I think this is a different issue involving a different NSS module.  
I suppose the present issue might be resolved by restoring the 
_nsl_default_nss symbol, for example.
Carlos O'Donell Jan. 30, 2018, 4:10 a.m. UTC | #7
On 01/29/2018 06:12 PM, Joseph Myers wrote:
> On Mon, 29 Jan 2018, H.J. Lu wrote:
> 
>> On Mon, Jan 29, 2018 at 5:01 PM, Joseph Myers <joseph@codesourcery.com> wrote:
>>> I think this introduces test failures in the case where there is an
>>> installed libnss_nis but you're not using --enable-obsolete-nsl, if
>>> /etc/nsswitch.conf has "passwd: compat".
>>>
>>> FAIL: nss/bug17079
>>> FAIL: nss/tst-nss-getpwent
>>>
>>> The output of make check for those tests shows (seen on Ubuntu 16.04):
>>> "relocation error: /lib/x86_64-linux-gnu/libnss_nis.so.2: symbol
>>> _nsl_default_nss version GLIBC_PRIVATE not defined in file libnsl.so.1
>>> with link time reference", for both those tests.
>>
>> This is:
>>
>> https://sourceware.org/bugzilla/show_bug.cgi?id=22530
>>
>> Should I reopen it?
> 
> No, I think this is a different issue involving a different NSS module.  
> I suppose the present issue might be resolved by restoring the 
> _nsl_default_nss symbol, for example.
 
This is clearly a bug in the test framework. We should mark it XFAIL for
2.27 and fix this in 2.28.

DJ has complete patches to add "in mount namespace" testing which allows us
to completely isolate NSS module tests. The work is complete and pending
some review by me before we post these publicly. DJ has even run the entire
testsuite through the installed-tree-equivalent testing that is provided
by testing in the mount namespace, though it requires your system be configured
to allow user mount namespaces. DJ can comment more here if he wishes.

I want to avoid anyone doing any work here because in 2.28 I'd expect
we'll have converted these tests to use this work (part of the support/
library), and avoid the host configuration issues that have plagued our
testing.
Florian Weimer Jan. 30, 2018, 7:54 a.m. UTC | #8
On 01/30/2018 02:01 AM, Joseph Myers wrote:
> I think this introduces test failures in the case where there is an
> installed libnss_nis but you're not using --enable-obsolete-nsl, if
> /etc/nsswitch.conf has "passwd: compat".
> 
> FAIL: nss/bug17079
> FAIL: nss/tst-nss-getpwent
> 
> The output of make check for those tests shows (seen on Ubuntu 16.04):
> "relocation error: /lib/x86_64-linux-gnu/libnss_nis.so.2: symbol
> _nsl_default_nss version GLIBC_PRIVATE not defined in file libnsl.so.1
> with link time reference", for both those tests.

Please try the attached patch.  It should not interfere with the test goal.

The issue could also be avoided if we disabled lazy binding for loading 
NSS modules, so that the module wouldn't be loaded at all, instead 
crashing later at run time.

Thanks,
Florian
Subject: [PATCH] nss: Adjust tests to use nss_files only
To: libc-alpha@sourceware.org

2018-01-30  Florian Weimer  <fweimer@redhat.com>

	* nss/bug17079.c (do_test): Use nss_files only for reading passwd
	data.
	* nss/tst-nss-getpwent.c (do_test): Likewise.

diff --git a/nss/bug17079.c b/nss/bug17079.c
index f3e88b349d..5f358f815a 100644
--- a/nss/bug17079.c
+++ b/nss/bug17079.c
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
+#include <nss.h>
 #include <pwd.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -213,6 +214,8 @@ test_buffer_size (size_t buffer_size)
 int
 do_test (void)
 {
+  __nss_configure_lookup ("passwd", "files");
+
   if (!init_test_items ())
     return 1;
   printf ("info: %d test items\n", test_count);
diff --git a/nss/tst-nss-getpwent.c b/nss/tst-nss-getpwent.c
index cdaef767fe..ff9c3d062e 100644
--- a/nss/tst-nss-getpwent.c
+++ b/nss/tst-nss-getpwent.c
@@ -15,6 +15,7 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#include <nss.h>
 #include <pwd.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -26,6 +27,8 @@
 int
 do_test (void)
 {
+  __nss_configure_lookup ("passwd", "files");
+
   /* Count the number of entries in the password database, and fetch
      data from the first and last entries.  */
   size_t count = 0;
Joseph Myers Jan. 30, 2018, 1:14 p.m. UTC | #9
On Tue, 30 Jan 2018, Florian Weimer wrote:

> On 01/30/2018 02:01 AM, Joseph Myers wrote:
> > I think this introduces test failures in the case where there is an
> > installed libnss_nis but you're not using --enable-obsolete-nsl, if
> > /etc/nsswitch.conf has "passwd: compat".
> > 
> > FAIL: nss/bug17079
> > FAIL: nss/tst-nss-getpwent
> > 
> > The output of make check for those tests shows (seen on Ubuntu 16.04):
> > "relocation error: /lib/x86_64-linux-gnu/libnss_nis.so.2: symbol
> > _nsl_default_nss version GLIBC_PRIVATE not defined in file libnsl.so.1
> > with link time reference", for both those tests.
> 
> Please try the attached patch.  It should not interfere with the test goal.

I confirm that this fixes those test failures for me.
Dmitry V. Levin Jan. 30, 2018, 1:24 p.m. UTC | #10
On Tue, Jan 30, 2018 at 01:14:18PM +0000, Joseph Myers wrote:
> On Tue, 30 Jan 2018, Florian Weimer wrote:
> > On 01/30/2018 02:01 AM, Joseph Myers wrote:
> > > I think this introduces test failures in the case where there is an
> > > installed libnss_nis but you're not using --enable-obsolete-nsl, if
> > > /etc/nsswitch.conf has "passwd: compat".
> > > 
> > > FAIL: nss/bug17079
> > > FAIL: nss/tst-nss-getpwent
> > > 
> > > The output of make check for those tests shows (seen on Ubuntu 16.04):
> > > "relocation error: /lib/x86_64-linux-gnu/libnss_nis.so.2: symbol
> > > _nsl_default_nss version GLIBC_PRIVATE not defined in file libnsl.so.1
> > > with link time reference", for both those tests.
> > 
> > Please try the attached patch.  It should not interfere with the test goal.
> 
> I confirm that this fixes those test failures for me.

Thanks, I think this patch should be applied then.
Florian Weimer Jan. 30, 2018, 1:27 p.m. UTC | #11
On 01/30/2018 02:24 PM, Dmitry V. Levin wrote:
> On Tue, Jan 30, 2018 at 01:14:18PM +0000, Joseph Myers wrote:
>> On Tue, 30 Jan 2018, Florian Weimer wrote:
>>> On 01/30/2018 02:01 AM, Joseph Myers wrote:
>>>> I think this introduces test failures in the case where there is an
>>>> installed libnss_nis but you're not using --enable-obsolete-nsl, if
>>>> /etc/nsswitch.conf has "passwd: compat".
>>>>
>>>> FAIL: nss/bug17079
>>>> FAIL: nss/tst-nss-getpwent
>>>>
>>>> The output of make check for those tests shows (seen on Ubuntu 16.04):
>>>> "relocation error: /lib/x86_64-linux-gnu/libnss_nis.so.2: symbol
>>>> _nsl_default_nss version GLIBC_PRIVATE not defined in file libnsl.so.1
>>>> with link time reference", for both those tests.
>>>
>>> Please try the attached patch.  It should not interfere with the test goal.
>>
>> I confirm that this fixes those test failures for me.
> 
> Thanks, I think this patch should be applied then.

Thanks, I've pushed it.

Florian
Szabolcs Nagy Jan. 31, 2018, 11:21 a.m. UTC | #12
On 29/01/18 13:32, Florian Weimer wrote:
> On 01/29/2018 02:30 PM, Andreas Schwab wrote:
>> On Jan 11 2018, fweimer@redhat.com (Florian Weimer) wrote:
>>
>>>     [BZ #22701]
>>>     * include/rpcsvc/nislib.h (__nis_default_ttl): Add
>>>     libnsl_hidden_proto.
>>>     * include/rpcsvc/yp.h (yp_xdrall): Declare with
>>>     libnsl_hidden_proto.
>>>     * include/rpcsvc/ypclnt.h (yp_maplist): Likewise.
>>>     * nis/Makefile (libnsl-routines): Add nss-default only for
>>>     build-obsolete-nsl.
>>>     * nis/nis_defaults.c (__nis_default_ttl): Add
>>>     libnsl_hidden_nolink_def.
>>>     * nis/rpcsvc/ypclnt.h (yp_maplist): Remove #ifdef'ed-out
>>>     declaration.
>>>     * nis/yp_xdr.c (xdr_ypall): Add libnsl_hidden_nolink_def.
>>>     * nis/ypclnt.c (yp_maplist): Likewise.
>>
>> Ok.
> 
> Dmitry, is it okay to sneak this into glibc 2.27?  The change is mostly cosmetic; the important change was not installing libnsl.so and 
> libnsl.a, and that is already on master.
> 

isn't this an internal abi break?

if i install glibc-2.27 on top of an earlier glibc install
without removing the previous libnss_nis.so.2, which references
_nsl_default_nss, then the new libnsl.so.1 will not have that
symbol so old libnss_nis.so.2 no longer works.

either i have to --enable-obsolete-nsl in the new libc or
remove the old libnss_nis.so.2 (and hope nothing needs it)
before i run the new ldconfig.

i thought 'installing over' previous libc is a valid use
(i do this when testing in chroot)
Florian Weimer Jan. 31, 2018, 12:53 p.m. UTC | #13
On 01/31/2018 12:21 PM, Szabolcs Nagy wrote:
> On 29/01/18 13:32, Florian Weimer wrote:
>> On 01/29/2018 02:30 PM, Andreas Schwab wrote:
>>> On Jan 11 2018, fweimer@redhat.com (Florian Weimer) wrote:
>>>
>>>>     [BZ #22701]
>>>>     * include/rpcsvc/nislib.h (__nis_default_ttl): Add
>>>>     libnsl_hidden_proto.
>>>>     * include/rpcsvc/yp.h (yp_xdrall): Declare with
>>>>     libnsl_hidden_proto.
>>>>     * include/rpcsvc/ypclnt.h (yp_maplist): Likewise.
>>>>     * nis/Makefile (libnsl-routines): Add nss-default only for
>>>>     build-obsolete-nsl.
>>>>     * nis/nis_defaults.c (__nis_default_ttl): Add
>>>>     libnsl_hidden_nolink_def.
>>>>     * nis/rpcsvc/ypclnt.h (yp_maplist): Remove #ifdef'ed-out
>>>>     declaration.
>>>>     * nis/yp_xdr.c (xdr_ypall): Add libnsl_hidden_nolink_def.
>>>>     * nis/ypclnt.c (yp_maplist): Likewise.
>>>
>>> Ok.
>>
>> Dmitry, is it okay to sneak this into glibc 2.27?  The change is 
>> mostly cosmetic; the important change was not installing libnsl.so and 
>> libnsl.a, and that is already on master.
>>
> 
> isn't this an internal abi break?

Not really, I think.

> if i install glibc-2.27 on top of an earlier glibc install
> without removing the previous libnss_nis.so.2, which references
> _nsl_default_nss, then the new libnsl.so.1 will not have that
> symbol so old libnss_nis.so.2 no longer works.
> 
> either i have to --enable-obsolete-nsl in the new libc or
> remove the old libnss_nis.so.2 (and hope nothing needs it)
> before i run the new ldconfig.
> 
> i thought 'installing over' previous libc is a valid use
> (i do this when testing in chroot)

A similar thing happens if you install a glibc over another glibc with 
different build flags, e.g. one that is using AT_PLATFORM directories.

We can certainly revert the change and reapply it for 2.28, maybe this 
time with a change which loads the NSS modules with RTLD_NOW, so that 
the missing GLIBC_PRIVATE symbol is detected at dlopen time and the NSS 
module is ignored (at least for now).

Thanks,
Florian
Szabolcs Nagy Jan. 31, 2018, 3:07 p.m. UTC | #14
On 31/01/18 12:53, Florian Weimer wrote:
> On 01/31/2018 12:21 PM, Szabolcs Nagy wrote:
>> On 29/01/18 13:32, Florian Weimer wrote:
>>> On 01/29/2018 02:30 PM, Andreas Schwab wrote:
>>>> On Jan 11 2018, fweimer@redhat.com (Florian Weimer) wrote:
>>>>
>>>>>     [BZ #22701]
>>>>>     * include/rpcsvc/nislib.h (__nis_default_ttl): Add
>>>>>     libnsl_hidden_proto.
>>>>>     * include/rpcsvc/yp.h (yp_xdrall): Declare with
>>>>>     libnsl_hidden_proto.
>>>>>     * include/rpcsvc/ypclnt.h (yp_maplist): Likewise.
>>>>>     * nis/Makefile (libnsl-routines): Add nss-default only for
>>>>>     build-obsolete-nsl.
>>>>>     * nis/nis_defaults.c (__nis_default_ttl): Add
>>>>>     libnsl_hidden_nolink_def.
>>>>>     * nis/rpcsvc/ypclnt.h (yp_maplist): Remove #ifdef'ed-out
>>>>>     declaration.
>>>>>     * nis/yp_xdr.c (xdr_ypall): Add libnsl_hidden_nolink_def.
>>>>>     * nis/ypclnt.c (yp_maplist): Likewise.
>>>>
>>>> Ok.
>>>
>>> Dmitry, is it okay to sneak this into glibc 2.27?  The change is mostly cosmetic; the important change was not installing libnsl.so and 
>>> libnsl.a, and that is already on master.
>>>
>>
>> isn't this an internal abi break?
> 
> Not really, I think.
> 
>> if i install glibc-2.27 on top of an earlier glibc install
>> without removing the previous libnss_nis.so.2, which references
>> _nsl_default_nss, then the new libnsl.so.1 will not have that
>> symbol so old libnss_nis.so.2 no longer works.
>>
>> either i have to --enable-obsolete-nsl in the new libc or
>> remove the old libnss_nis.so.2 (and hope nothing needs it)
>> before i run the new ldconfig.
>>
>> i thought 'installing over' previous libc is a valid use
>> (i do this when testing in chroot)
> 
> A similar thing happens if you install a glibc over another glibc with different build flags, e.g. one that is using AT_PLATFORM directories.
> 
> We can certainly revert the change and reapply it for 2.28, maybe this time with a change which loads the NSS modules with RTLD_NOW, so that the 
> missing GLIBC_PRIVATE symbol is detected at dlopen time and the NSS module is ignored (at least for now).
> 

i think RTLD_NOW wont help me, i run ldconfig in the
chroot with mixed old and new glibc libs and ldconfig
fails to process libnss_nis.so.2

chroot /tmp/tmp6YjWM3/chroot sudo /sbin/ldconfig
sudo: relocation error: /lib/aarch64-linux-gnu/libnss_nis.so.2: symbol _nsl_default_nss version GLIBC_PRIVATE not defined in file libnsl.so.1 
with link time reference

i guess i will work this around in the chroot build script.
(i assume it's enough to remove the obsolete nss libs
and potentially update the /etc/nsswitch.conf if things
dont work with the old one)
Szabolcs Nagy Jan. 31, 2018, 3:34 p.m. UTC | #15
On 31/01/18 15:07, Szabolcs Nagy wrote:
> On 31/01/18 12:53, Florian Weimer wrote:
>> On 01/31/2018 12:21 PM, Szabolcs Nagy wrote:
>>> if i install glibc-2.27 on top of an earlier glibc install
>>> without removing the previous libnss_nis.so.2, which references
>>> _nsl_default_nss, then the new libnsl.so.1 will not have that
>>> symbol so old libnss_nis.so.2 no longer works.
>>>
>>> either i have to --enable-obsolete-nsl in the new libc or
>>> remove the old libnss_nis.so.2 (and hope nothing needs it)
>>> before i run the new ldconfig.
>>>
>>> i thought 'installing over' previous libc is a valid use
>>> (i do this when testing in chroot)
>>
>> A similar thing happens if you install a glibc over another glibc with different build flags, e.g. one that is using AT_PLATFORM directories.
>>
>> We can certainly revert the change and reapply it for 2.28, maybe this time with a change which loads the NSS modules with RTLD_NOW, so that 
>> the missing GLIBC_PRIVATE symbol is detected at dlopen time and the NSS module is ignored (at least for now).
>>
> 
> i think RTLD_NOW wont help me, i run ldconfig in the
> chroot with mixed old and new glibc libs and ldconfig
> fails to process libnss_nis.so.2
> 
> chroot /tmp/tmp6YjWM3/chroot sudo /sbin/ldconfig
> sudo: relocation error: /lib/aarch64-linux-gnu/libnss_nis.so.2: symbol _nsl_default_nss version GLIBC_PRIVATE not defined in file libnsl.so.1 
> with link time reference
> 

sorry you were right, it's sudo that fails, so RTLD_NOW
would make the dlopen fail and then there would be no
runtime failure.

(i thought it's ldconfig that tries to load the library somehow)

anyway i'll have a workaround for this so either way is
fine for me (revert or keep).

> i guess i will work this around in the chroot build script.
> (i assume it's enough to remove the obsolete nss libs
> and potentially update the /etc/nsswitch.conf if things
> dont work with the old one)
Szabolcs Nagy Jan. 31, 2018, 5:22 p.m. UTC | #16
On 31/01/18 15:34, Szabolcs Nagy wrote:
> On 31/01/18 15:07, Szabolcs Nagy wrote:
>> On 31/01/18 12:53, Florian Weimer wrote:
>>> A similar thing happens if you install a glibc over another glibc with different build flags, e.g. one that is using AT_PLATFORM directories.
>>>
>>> We can certainly revert the change and reapply it for 2.28, maybe this time with a change which loads the NSS modules with RTLD_NOW, so that 
>>> the missing GLIBC_PRIVATE symbol is detected at dlopen time and the NSS module is ignored (at least for now).
>>
>> chroot /tmp/tmp6YjWM3/chroot sudo /sbin/ldconfig
>> sudo: relocation error: /lib/aarch64-linux-gnu/libnss_nis.so.2: symbol _nsl_default_nss version GLIBC_PRIVATE not defined in file libnsl.so.1 
>> with link time reference
> 
> sorry you were right, it's sudo that fails, so RTLD_NOW
> would make the dlopen fail and then there would be no
> runtime failure.
> 

i opened
https://sourceware.org/bugzilla/show_bug.cgi?id=22766
diff mbox series

Patch

diff --git a/include/rpcsvc/nislib.h b/include/rpcsvc/nislib.h
index 91dab1d171..ad4d499911 100644
--- a/include/rpcsvc/nislib.h
+++ b/include/rpcsvc/nislib.h
@@ -42,6 +42,7 @@  libnsl_hidden_proto (nis_remove)
 libnsl_hidden_proto (nis_add)
 libnsl_hidden_proto (__nis_default_owner)
 libnsl_hidden_proto (__nis_default_group)
+libnsl_hidden_proto (__nis_default_ttl)
 libnsl_hidden_proto (__nis_default_access)
 libnsl_hidden_proto (nis_clone_object)
 libnsl_hidden_proto (nis_clone_result)
diff --git a/include/rpcsvc/yp.h b/include/rpcsvc/yp.h
index 9078854d40..87cd3827a7 100644
--- a/include/rpcsvc/yp.h
+++ b/include/rpcsvc/yp.h
@@ -3,6 +3,9 @@ 
 
 # ifndef _ISOMAC
 
+struct ypall_callback;
+bool_t xdr_ypall (XDR *, struct ypall_callback *);
+
 libnsl_hidden_proto (xdr_ypstat)
 libnsl_hidden_proto (xdr_ypxfrstat)
 libnsl_hidden_proto (xdr_domainname)
@@ -28,6 +31,7 @@  libnsl_hidden_proto (xdr_ypreq_xfr)
 libnsl_hidden_proto (xdr_ypresp_xfr)
 libnsl_hidden_proto (xdr_yppushresp_xfr)
 libnsl_hidden_proto (xdr_ypbind_setdom)
+libnsl_hidden_proto (xdr_ypall)
 
 # endif /* !_ISOMAC */
 #endif
diff --git a/include/rpcsvc/ypclnt.h b/include/rpcsvc/ypclnt.h
index df2a03d9c5..c6a724814c 100644
--- a/include/rpcsvc/ypclnt.h
+++ b/include/rpcsvc/ypclnt.h
@@ -3,6 +3,9 @@ 
 
 # ifndef _ISOMAC
 
+struct ypmaplist;
+int yp_maplist (const char *, struct ypmaplist **) __THROW;
+
 libnsl_hidden_proto (ypbinderr_string)
 libnsl_hidden_proto (yp_bind)
 libnsl_hidden_proto (yp_get_default_domain)
@@ -17,6 +20,7 @@  libnsl_hidden_proto (yp_next)
 libnsl_hidden_proto (yp_match)
 libnsl_hidden_proto (yp_all)
 libnsl_hidden_proto (__yp_check)
+libnsl_hidden_proto (yp_maplist)
 
 # endif /* !_ISOMAC */
 #endif
diff --git a/nis/Makefile b/nis/Makefile
index fae30d5da1..b828c5ec4d 100644
--- a/nis/Makefile
+++ b/nis/Makefile
@@ -58,9 +58,10 @@  libnsl-routines = yp_xdr ypclnt ypupdate_xdr \
 		  nis_print_group_entry nis_domain_of nis_domain_of_r\
 		  nis_modify nis_remove nis_add nis_defaults\
 		  nis_findserv nis_callback nis_clone_dir nis_clone_obj\
-		  nis_clone_res nss-default
+		  nis_clone_res
 
 ifeq ($(build-obsolete-nsl),yes)
+libnsl-routines += nss-default
 libnss_nis-routines	:= $(addprefix nis-,$(databases)) nis-initgroups \
 			   nss-nis
 libnss_nis-inhibit-o	= $(filter-out .os,$(object-suffixes))
diff --git a/nis/nis_defaults.c b/nis/nis_defaults.c
index 58e64a8e98..0be47aa65c 100644
--- a/nis/nis_defaults.c
+++ b/nis/nis_defaults.c
@@ -428,6 +428,7 @@  __nis_default_ttl (char *defaults)
 
   return searchttl (cptr);
 }
+libnsl_hidden_nolink_def (__nis_default_ttl, GLIBC_2_1)
 
 /* Default access rights are ----rmcdr---r---, but we could change
    this with the NIS_DEFAULTS variable. */
diff --git a/nis/rpcsvc/ypclnt.h b/nis/rpcsvc/ypclnt.h
index b96cb3b40e..af904fccb2 100644
--- a/nis/rpcsvc/ypclnt.h
+++ b/nis/rpcsvc/ypclnt.h
@@ -76,9 +76,6 @@  extern const char *ypbinderr_string (const int) __THROW;
 extern int ypprot_err (const int) __THROW;
 extern int yp_update (char *, char *, unsigned int,  char *,
 		      int, char *, int) __THROW;
-#if 0
-extern int yp_maplist (const char *, struct ypmaplist **) __THROW;
-#endif
 
 /* This functions exists only under BSD and Linux systems.  */
 extern int __yp_check (char **) __THROW;
diff --git a/nis/yp_xdr.c b/nis/yp_xdr.c
index 0081b4c926..3b576731da 100644
--- a/nis/yp_xdr.c
+++ b/nis/yp_xdr.c
@@ -327,4 +327,4 @@  xdr_ypall(XDR *xdrs, struct ypall_callback *incallback)
 	    return FALSE;
     }
 }
-/* XXX libnsl_hidden_nolink_def(xdr_ypall, GLIBC_2_2) */
+libnsl_hidden_nolink_def (xdr_ypall, GLIBC_2_2)
diff --git a/nis/ypclnt.c b/nis/ypclnt.c
index 95215e2f67..11a17db98d 100644
--- a/nis/ypclnt.c
+++ b/nis/ypclnt.c
@@ -813,6 +813,7 @@  yp_maplist (const char *indomain, struct ypmaplist **outmaplist)
 
   return result;
 }
+libnsl_hidden_nolink_def (yp_maplist, GLIBC_2_0)
 
 const char *
 yperr_string (const int error)