Bug 62842

Summary: exportfs -r crashes when sees netgroup in /etc/exports
Product: [Retired] Red Hat Linux Reporter: Aleksey Nogin <aleksey>
Component: glibAssignee: Pete Zaitcev <zaitcev>
Status: CLOSED RAWHIDE QA Contact: Ben Levenson <benl>
Severity: high Docs Contact:
Priority: medium    
Version: 7.3CC: jakub
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2002-04-11 15:07:19 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 61590    

Description Aleksey Nogin 2002-04-06 02:36:58 UTC
exportfs -r crashes 100% reliably when it sees a netgroup entry in /etc/exports.

(gdb) bt
#0  0x42080be3 in strlen () from /lib/i686/libc.so.6
#1  0x420f4ec2 in __nss_lookup_function () from /lib/i686/libc.so.6
#2  0x420f5b06 in __nss_lookup () from /lib/i686/libc.so.6
#3  0x420f6ddf in __nss_netgroup_lookup () from /lib/i686/libc.so.6
#4  0x420fe8ed in innetgr () from /lib/i686/libc.so.6
#5  0x0804a0d7 in strcpy ()
#6  0x0804a5f7 in strcpy ()
#7  0x0804a696 in strcpy ()
#8  0x0804b030 in strcpy ()
#9  0x080492cd in strcpy ()
#10 0x420174d9 in __libc_start_main () from /lib/i686/libc.so.6

This worked fine in 7.2 and beta3, but stopped after I up2date'd to beta4.

Comment 1 Bob Matthews 2002-04-10 17:14:38 UTC
Is rpc.mountd still running after this crash?

Comment 2 Bob Matthews 2002-04-10 17:57:30 UTC
I've made mountd crash at a slightly different place, but I believe this may be
related to your problem.

I think the problem may lie in the libc function innetgr() which is called by
mountd when resolving netgroup members.

From execution of mountd:

(gdb) list
226	 */
227	int
228	client_check(nfs_client *clp, struct hostent *hp)
229	{
230		char	*hname = (char *) hp->h_name;
231		char	*cname = clp->m_hostname;
232		char	**ap;
233	
234		switch (clp->m_type) {
235		case MCL_FQDN:
(gdb) n
229	{
(gdb) n
230		char	*hname = (char *) hp->h_name;
(gdb) n
231		char	*cname = clp->m_hostname;
(gdb) n
234		switch (clp->m_type) {
(gdb) n
261				if (innetgr(cname+1, hname, NULL, NULL))
(gdb) p cname
$18 = 0x8057ca4 "@default"
(gdb) p hname
$19 = 0x805a3a4 "foo.bar.redhat.com"
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x42080be3 in strlen () from /lib/i686/libc.so.6
(gdb)bt
#0  0x42080be3 in strlen () from /lib/i686/libc.so.6
#1  0x420f4ec2 in __nss_lookup_function () from /lib/i686/libc.so.6
#2  0x420f5b06 in __nss_lookup () from /lib/i686/libc.so.6
#3  0x420f6ddf in __nss_netgroup_lookup () from /lib/i686/libc.so.6
#4  0x420fe8ed in innetgr () from /lib/i686/libc.so.6
#5  0x0804be9b in client_check (clp=0x8057ca0, hp=0x805a390) at client.c:261


--

In this trivial case, /etc/exports is
/scratch	@default(rw,no_root_squash)

and /etc/netgroup is
default (,,)

and foo.bar.redhat.com is the name of the machine which is attempting to mount
/scratch from the server.

Jakub, can you confirm that innetgr ("default", "foo.bar.redhat.com", NULL,
NULL) is a legal call?

# rpm -q glibc
glibc-2.2.5-30



Comment 3 Jakub Jelinek 2002-04-11 15:07:14 UTC
Yes, innetgr ("default", "foo.bar.redhat.com", NULL, NULL);
is a legal call.
Can you try glibc-2.2.5-32?
I'd guess this should be fixed by 2002-04-02
        * inet/getnetgrent_r.c (__nss_netgroup_lookup): Likewise.
change.

Comment 4 Bob Matthews 2002-04-11 16:06:13 UTC
Fixed with glibc-2.2.5-32

Comment 5 Aleksey Nogin 2002-04-12 19:19:30 UTC
Yes, this now works for me. Thanks!