bin/73422: portmap forks ad infinitum when the NIS domain name is set, probably a bug in the RPC library

Trond Endrestøl Trond.Endrestol at gtf.ol.no
Tue Nov 2 08:00:50 PST 2004


>Number:         73422
>Category:       bin
>Synopsis:       portmap forks ad infinitum when the NIS domain name is set, probably a bug in the RPC library
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Nov 02 16:00:49 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Trond Endrestøl
>Release:        FreeBSD 4.10-RELEASE i386
>Organization:
Private
>Environment:
>Description:

I'm in the process of setting up NIS in my home and I've found a
problem that I believe resides in the RPC library.  I'm running
4.10-RELEASE and I've followed the instructions in the Handbook.
I've used FreeBSD since 1998, but I have only recently turned my
interest to NIS.

(Speaking of the Handbook, has anyone tried these instructions lately
and verified that you'll actually achieve the goal? Is NIS tested when
a new -RELEASE is rolled out?)

When portmap receives a request, any request, portmap uses the RPC
library to maintain the port mappings.  When the RPC library discovers
the NIS domain name is set, it tries to get the port of the NIS client
(i.e. ypbind).  As a result, if ypbind is not registered, ypbind might
even be in the process of registering with portmap right now, another
portmap process is created to service the request.  The new portmap
process is still using the very same RPC library, which in turn
discovers again the name of the NIS domain and tries to get hold of
the port belonging to the NIS client, and next, the snowball is
rolling and rolling, and soon the system has hundreds, if not
thousands, of portmap processes getting nowhere.

I've changed ypbind slightly so that it does not check the NIS domain
name before checking the command line, see the patch below.
Note: This is a very poor workaround! The real problem is still in the
RPC library.

My computers are all set up to be NIS servers, master or slaves, and
are therefore commanded to bind to themselves.  When the NIS servers
and clients (i.e. ypserv and ypbind) are finally up and running, I can
set the NIS domain name using domainname, and everything is OK unless
ypbind dies.

Should ypbind die, I need to unset the NIS domain name in order not to
trigger this nasty problem in the RPC library, restart ypbind, and set
the NIS domain name again.

Can someone fix the RPC library?  I guess the RPC library shouldn't
create and post requests on its own when processing other requests.

If no one corrects the RPC library, then part of the Handbook should
be rewritten, at least make a note that the RPC system, and thus NIS,
is broken.  RPC and NFS is still working though.

>How-To-Repeat:

Run portmap with a NIS domain name set, and try engaging portmap
by the use of rpcinfo, mountd, nfsd, whatever.

>Fix:

Patch for ypbind.c follows:

*** ypbind.c.orig	Fri Feb 15 01:46:59 2002
--- ypbind.c	Tue Nov  2 13:47:58 2004
***************
*** 403,413 ****
  	if (flock(yplockfd, LOCK_EX|LOCK_NB) == -1 && errno == EWOULDBLOCK)
  		errx(1, "another ypbind is already running. Aborting");
  
- 	/* XXX domainname will be overriden if we use restricted mode */
- 	yp_get_default_domain(&domain_name);
- 	if (domain_name[0] == '\0')
- 		errx(1, "domainname not set. Aborting");
- 
  	for (i = 1; i<argc; i++) {
  		if (strcmp("-ypset", argv[i]) == 0)
  			ypsetmode = YPSET_ALL;
--- 403,408 ----
***************
*** 419,424 ****
--- 414,426 ----
  			yp_restricted_mode(argv[i+1]);
  		else if (strcmp("-m", argv[i]) == 0)
  			yp_manycast++;
+ 	}
+ 
+ 	if (domain_name == NULL || domain_name[0] == '\0') {
+ 		/* XXX domainname will be overriden if we use restricted mode */
+ 		yp_get_default_domain(&domain_name);
+ 		if (domain_name[0] == '\0')
+ 			errx(1, "domainname not set. Aborting");
  	}
  
  	/* blow away everything in BINDINGDIR (if it exists) */

>Release-Note:
>Audit-Trail:
>Unformatted:
 >System:
 


More information about the freebsd-bugs mailing list