Skip to contentSkip to conversation

add missing libtirpc lib to mount_nfs.so when TIRPC enabled

PATCH In review Lan Yixun (dlan) 2 participants 3 messages Jul 24, 2013 Kernel automounter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add missing libtirpc lib to mount_nfs.so when TIRPC enabled

From: "Lan Yixun (dlan)" <[email protected]>

this is need when libtirpc is enabled, otherwise autofs fail to start due to it can't find symbol clnt_dg_create (which is provided by libtirpc)

---
autofs error log from /var/log/message:

Jul 23 12:11:58 ofire automount[25699]: open_mount:244: parse(sun): cannot open mount module
nfs (/usr/lib64/autofs/mount_nfs.so: undefined symbol: clnt_dg_create)
Jul 23 12:11:58 ofire automount[25699]: lookup(file): failed to open parse context

without this patch, mount_nfs.so fail link to libtirpc.so

 # ldd /usr/lib64/autofs/mount_nfs.so |grep tirpc

with this patch applied:

 # ldd /usr/lib64/autofs/mount_nfs.so |grep tirpc
        libtirpc.so.1 => /lib64/libtirpc.so.1 (0x00007f7d94920000)
---
 modules/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
modules/Makefile +1 -1
index 4bb1096..0fe8ae8 100644
@@ -116,6 +116,6 @@ lookup_ldap.so: lookup_ldap.c dclist.o base64.o $(SASL_OBJ)
 
 mount_nfs.so: mount_nfs.c replicated.o
 	$(CC) $(SOLDFLAGS) $(CFLAGS) -o mount_nfs.so \
-		mount_nfs.c replicated.o $(AUTOFS_LIB) $(LIBNSL)
+		mount_nfs.c replicated.o $(AUTOFS_LIB) $(LIBNSL) $(TIRPCLIB)
 	$(STRIP) mount_nfs.so
 
Signature · 1 line
1.8.3.2
maintainer
#1 lore raw
Quoted 4 lines · Lan Yixun (dlan)

From: "Lan Yixun (dlan)" <[email protected]>

this is need when libtirpc is enabled, otherwise autofs fail to start due to it can't find symbol clnt_dg_create (which is provided by libtirpc)

Yeah, I use libtirpc all the time but that's something I haven't noticed, probably because TIRPC_WORKAROUND will cause the library to be dlopen()ed at start.

So while the change is needed and I'll apply it, I'm not sure why you're seeing it since the library should be open and loaded already.

Quoted 32 lines

---
autofs error log from /var/log/message:

Jul 23 12:11:58 ofire automount[25699]: open_mount:244: parse(sun): cannot open mount module
nfs (/usr/lib64/autofs/mount_nfs.so: undefined symbol: clnt_dg_create)
Jul 23 12:11:58 ofire automount[25699]: lookup(file): failed to open parse context

without this patch, mount_nfs.so fail link to libtirpc.so

 # ldd /usr/lib64/autofs/mount_nfs.so |grep tirpc

with this patch applied:

 # ldd /usr/lib64/autofs/mount_nfs.so |grep tirpc
        libtirpc.so.1 => /lib64/libtirpc.so.1 (0x00007f7d94920000)
---
 modules/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
modules/Makefile +1 -1
index 4bb1096..0fe8ae8 100644
@@ -116,6 +116,6 @@ lookup_ldap.so: lookup_ldap.c dclist.o base64.o $(SASL_OBJ)
 
 mount_nfs.so: mount_nfs.c replicated.o
 	$(CC) $(SOLDFLAGS) $(CFLAGS) -o mount_nfs.so \
-		mount_nfs.c replicated.o $(AUTOFS_LIB) $(LIBNSL)
+		mount_nfs.c replicated.o $(AUTOFS_LIB) $(LIBNSL) $(TIRPCLIB)
 	$(STRIP) mount_nfs.so
 
#2 lore raw
Quoted 39 lines · Ian Kent
Quoted 4 lines · Lan Yixun (dlan)

From: "Lan Yixun (dlan)" <[email protected]>

this is need when libtirpc is enabled, otherwise autofs fail to start due to it can't find symbol clnt_dg_create (which is provided by libtirpc)

Yeah, I use libtirpc all the time but that's something I haven't noticed, probably because TIRPC_WORKAROUND will cause the library to be dlopen()ed at start.

So while the change is needed and I'll apply it, I'm not sure why you're seeing it since the library should be open and loaded already.

Quoted 26 lines

---
autofs error log from /var/log/message:

Jul 23 12:11:58 ofire automount[25699]: open_mount:244: parse(sun): cannot open mount module
nfs (/usr/lib64/autofs/mount_nfs.so: undefined symbol: clnt_dg_create)
Jul 23 12:11:58 ofire automount[25699]: lookup(file): failed to open parse context

without this patch, mount_nfs.so fail link to libtirpc.so

 # ldd /usr/lib64/autofs/mount_nfs.so |grep tirpc

with this patch applied:

 # ldd /usr/lib64/autofs/mount_nfs.so |grep tirpc
        libtirpc.so.1 => /lib64/libtirpc.so.1 (0x00007f7d94920000)
---
 modules/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
modules/Makefile +0 -0
index 4bb1096..0fe8ae8 100644
@@ -116,6 +116,6 @@ lookup_ldap.so: lookup_ldap.c dclist.o base64.o $(SASL_OBJ)
 
Quoted 8 lines

modules/Makefile lookup_ldap.so: lookup_ldap.c dclist.o base64.o $(SASL_OBJ) · line 121

Quoted 6 lines
modules/Makefile +1 -1
 mount_nfs.so: mount_nfs.c replicated.o
      $(CC) $(SOLDFLAGS) $(CFLAGS) -o mount_nfs.so \
-             mount_nfs.c replicated.o $(AUTOFS_LIB) $(LIBNSL)
+             mount_nfs.c replicated.o $(AUTOFS_LIB) $(LIBNSL) $(TIRPCLIB)
      $(STRIP) mount_nfs.so
 

Hi Ian:
I spend a few time dig into the code, and found the root cause. In gentoo linux, user are legal to pass customized CFLAGS/LDFLAGS,
and here we append "-Wl,--as-needed" to LDFLAGS.
with this flag append, the final image - "automount" won't link to library tirpc.
command of "ldd /usr/sbin/automount |grep tirpc" shows nothing. I think this is totally fine, since autmount itself doesn't use any symbol from libtirpc.
but without my previous patch, the mount_nfs.so don't link to
libtirpc, see following.

 # ldd /usr/lib64/autofs/mount_nfs.so
        linux-vdso.so.1 (0x00007fff4bfff000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x00007fc55957c000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fc5591d1000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fc559a04000)
 #objdump -t /usr/lib64/autofs/mount_nfs.so |grep clnt_dg_creat
        0000000000000000         *UND*  0000000000000000
clnt_dg_create

you can see clnt_dg_create is a undefined symbol, which is come from libtirpc. so, module mount_nfs need libtirpc.

I think you haven't encounter the problem is that the application
automont accidentally link in libtirpc, while mount_nfs.so doesn't. so mount_nfs.so can found the symbol which loaded by automount when it started to run.
I can filter the "-Wl,--as-needed" flag, but still think my patch
address right to the problem.
Thanks.

Dennis Lan (dlan)