Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Mar 2019 02:42:49 +0000 (UTC)
From:      Sean Eric Fagan <sef@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r344995 - in stable/12: sys/kgssapi usr.sbin/gssd
Message-ID:  <201903110242.x2B2gnNE032896@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903110242.x2B2gnNE032896>