Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:34 -0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r346038 - head/sbin/mount
Message-ID:  <201904081816.x38IGopn049301@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Apr  8 18:16:49 2019
New Revision: 346038
URL: https://svnweb.freebsd.org/changeset/base/346038

Log:
  Exercise some care before sending SIGHUP to mountd.
  
  Reviewed by:	antoine, emaste, oshogbo
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D19847

Modified:
  head/sbin/mount/mount.c

Modified: head/sbin/mount/mount.c
==============================================================================
--- head/sbin/mount/mount.c	Mon Apr  8 18:15:10 2019	(r346037)
+++ head/sbin/mount/mount.c	Mon Apr  8 18:16:49 2019	(r346038)
@@ -227,6 +227,7 @@ restart_mountd(void)
 	struct pidfh *pfh;
 	pid_t mountdpid;
 
+	mountdpid = 0;
 	pfh = pidfile_open(_PATH_MOUNTDPID, 0600, &mountdpid);
 	if (pfh != NULL) {
 		/* Mountd is not running. */
@@ -237,6 +238,16 @@ restart_mountd(void)
 		/* Cannot open pidfile for some reason. */
 		return;
 	}
+
+	/*
+	 * Refuse to send broadcast or group signals, this has
+	 * happened due to the bugs in pidfile(3).
+	 */
+	if (mountdpid <= 0) {
+		warnx("mountd pid %d, refusing to send SIGHUP", mountdpid);
+		return;
+	}
+
 	/* We have mountd(8) PID in mountdpid varible, let's signal it. */
 	if (kill(mountdpid, SIGHUP) == -1)
 		err(1, "signal mountd");





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