svn commit: r344995 - in stable/12: sys/kgssapi usr.sbin/gssd

Sean Eric Fagan sef at FreeBSD.org
Mon Mar 11 02:42:50 UTC 2019


Author: sef
Date: Mon Mar 11 02:42:49 2019
New Revision: 344995
URL: https://svnweb.freebsd.org/changeset/base/344995

Log:
  MFC r344402
  
  * Handle SIGPIPE in gssd
  We've got some cases where the other end of gssd's AF_LOCAL socket gets
  closed, resulting in an error (and SIGPIPE) when it tries to do I/O to it.
  Closing without cleaning up means the next time nfsd starts up, it hangs,
  unkillably; this allows gssd to handle that particular error.
  
  * Limit the retry cound in gssd_syscall to 5.
  The default is INT_MAX, which effectively means forever.  And it's an
  uninterruptable RPC call, so it will never stop.
  
  The two changes mitigate the problem.

Modified:
  stable/12/sys/kgssapi/gss_impl.c
  stable/12/usr.sbin/gssd/gssd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kgssapi/gss_impl.c
==============================================================================
--- stable/12/sys/kgssapi/gss_impl.c	Mon Mar 11 02:02:04 2019	(r344994)
+++ stable/12/sys/kgssapi/gss_impl.c	Mon Mar 11 02:42:49 2019	(r344995)
@@ -112,6 +112,15 @@ sys_gssd_syscall(struct thread *td, struct gssd_syscal
 		cl = clnt_reconnect_create(nconf,
 		    (struct sockaddr *) &sun, GSSD, GSSDVERS,
 		    RPC_MAXDATASIZE, RPC_MAXDATASIZE);
+		/*
+		 * The number of retries defaults to INT_MAX, which effectively
+		 * means an infinite, uninterruptable loop.  Limiting it to
+		 * five retries keeps it from running forever.
+		 */
+		if (cl != NULL) {
+			int retry_count = 5;
+			CLNT_CONTROL(cl, CLSET_RETRIES, &retry_count);
+		}
 	} else
 		cl = NULL;
 

Modified: stable/12/usr.sbin/gssd/gssd.c
==============================================================================
--- stable/12/usr.sbin/gssd/gssd.c	Mon Mar 11 02:02:04 2019	(r344994)
+++ stable/12/usr.sbin/gssd/gssd.c	Mon Mar 11 02:42:49 2019	(r344995)
@@ -202,6 +202,7 @@ main(int argc, char **argv)
 		signal(SIGHUP, SIG_IGN);
 	}
 	signal(SIGTERM, gssd_terminate);
+	signal(SIGPIPE, gssd_terminate);
 
 	memset(&sun, 0, sizeof sun);
 	sun.sun_family = AF_LOCAL;


More information about the svn-src-stable-12 mailing list