2 * Copyright (c) 2011 James Gritton
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 #include <sys/cdefs.h>
28 __FBSDID("$FreeBSD$");
30 #include <sys/types.h>
31 #include <sys/event.h>
32 #include <sys/mount.h>
34 #include <sys/sysctl.h>
42 #include <login_cap.h>
53 #define DEFAULT_STOP_TIMEOUT 10
54 #define PHASH_SIZE 256
56 LIST_HEAD(phhead, phash);
66 extern char **environ;
68 static int run_command(struct cfjail *j);
69 static int add_proc(struct cfjail *j, pid_t pid);
70 static void clear_procs(struct cfjail *j);
71 static struct cfjail *find_proc(pid_t pid);
72 static int term_procs(struct cfjail *j);
73 static int get_user_info(struct cfjail *j, const char *username,
74 const struct passwd **pwdp, login_cap_t **lcapp);
75 static int check_path(struct cfjail *j, const char *pname, const char *path,
76 int isfile, const char *umount_type);
78 static struct cfjails sleeping = TAILQ_HEAD_INITIALIZER(sleeping);
79 static struct cfjails runnable = TAILQ_HEAD_INITIALIZER(runnable);
80 static struct cfstring dummystring = { .len = 1 };
81 static struct phhead phash[PHASH_SIZE];
85 * Run the next command associated with a jail.
88 next_command(struct cfjail *j)
90 enum intparam comparam;
91 int create_failed, stopping;
94 requeue(j, &runnable);
97 create_failed = (j->flags & (JF_STOP | JF_FAILED)) == JF_FAILED;
98 stopping = (j->flags & JF_STOP) != 0;
99 comparam = *j->comparam;
101 if (j->comstring == NULL) {
102 j->comparam += create_failed ? -1 : 1;
103 switch ((comparam = *j->comparam)) {
107 if (!bool_param(j->intparams[IP_MOUNT_DEVFS]))
109 j->comstring = &dummystring;
111 case IP_MOUNT_FDESCFS:
112 if (!bool_param(j->intparams[IP_MOUNT_FDESCFS]))
114 j->comstring = &dummystring;
116 case IP_MOUNT_PROCFS:
117 if (!bool_param(j->intparams[IP_MOUNT_PROCFS]))
119 j->comstring = &dummystring;
122 case IP_STOP_TIMEOUT:
123 j->comstring = &dummystring;
126 if (j->intparams[comparam] == NULL)
128 j->comstring = create_failed || (stopping &&
129 (j->intparams[comparam]->flags & PF_REV))
130 ? TAILQ_LAST(&j->intparams[comparam]->val,
132 : TAILQ_FIRST(&j->intparams[comparam]->val);
135 j->comstring = j->comstring == &dummystring ? NULL :
136 create_failed || (stopping &&
137 (j->intparams[comparam]->flags & PF_REV))
138 ? TAILQ_PREV(j->comstring, cfstrings, tq)
139 : TAILQ_NEXT(j->comstring, tq);
141 if (j->comstring == NULL || j->comstring->len == 0 ||
142 (create_failed && (comparam == IP_EXEC_PRESTART ||
143 comparam == IP_EXEC_START || comparam == IP_COMMAND ||
144 comparam == IP_EXEC_POSTSTART)))
146 switch (run_command(j)) {
157 * Check command exit status
160 finish_command(struct cfjail *j)
164 if (!(j->flags & JF_SLEEPQ))
166 j->flags &= ~JF_SLEEPQ;
167 if (*j->comparam == IP_STOP_TIMEOUT)
169 j->flags &= ~JF_TIMEOUT;
174 if (!TAILQ_EMPTY(&runnable))
175 requeue(TAILQ_FIRST(&runnable), &ready);
177 if (j->flags & JF_TIMEOUT) {
178 j->flags &= ~JF_TIMEOUT;
179 if (*j->comparam != IP_STOP_TIMEOUT) {
180 jail_warnx(j, "%s: timed out", j->comline);
183 } else if (verbose > 0)
184 jail_note(j, "timed out\n");
185 } else if (j->pstatus != 0) {
186 if (WIFSIGNALED(j->pstatus))
187 jail_warnx(j, "%s: exited on signal %d",
188 j->comline, WTERMSIG(j->pstatus));
190 jail_warnx(j, "%s: failed", j->comline);
201 * Check for finished processes or timeouts.
204 next_proc(int nonblock)
208 struct timespec *tsp;
211 if (!TAILQ_EMPTY(&sleeping)) {
214 if ((j = TAILQ_FIRST(&sleeping)) && j->timeout.tv_sec) {
215 clock_gettime(CLOCK_REALTIME, &ts);
216 ts.tv_sec = j->timeout.tv_sec - ts.tv_sec;
217 ts.tv_nsec = j->timeout.tv_nsec - ts.tv_nsec;
218 if (ts.tv_nsec < 0) {
220 ts.tv_nsec += 1000000000;
223 (ts.tv_sec == 0 && ts.tv_nsec == 0)) {
224 j->flags |= JF_TIMEOUT;
235 switch (kevent(kq, NULL, 0, &ke, 1, tsp)) {
242 j = TAILQ_FIRST(&sleeping);
243 j->flags |= JF_TIMEOUT;
249 (void)waitpid(ke.ident, NULL, WNOHANG);
250 if ((j = find_proc(ke.ident))) {
251 j->pstatus = ke.data;
261 * Run a single command for a jail, possible inside the jail.
264 run_command(struct cfjail *j)
266 const struct passwd *pwd;
267 const struct cfstring *comstring, *s;
270 char *cs, *comcs, *devpath;
271 const char *jidstr, *conslog, *path, *ruleset, *term, *username;
272 enum intparam comparam;
275 int argc, bg, clean, consfd, down, fib, i, injail, sjuser, timeout;
276 #if defined(INET) || defined(INET6)
277 char *addr, *extrap, *p, *val;
280 static char *cleanenv;
282 /* Perform some operations that aren't actually commands */
283 comparam = *j->comparam;
284 down = j->flags & (JF_STOP | JF_FAILED);
286 case IP_STOP_TIMEOUT:
287 return term_procs(j);
291 if (jail_remove(j->jid) < 0 && errno == EPERM) {
292 jail_warnx(j, "jail_remove: %s",
296 if (verbose > 0 || (verbose == 0 && (j->flags & JF_STOP
297 ? note_remove : j->name != NULL)))
298 jail_note(j, "removed\n");
300 if (j->flags & JF_STOP)
301 dep_done(j, DF_LIGHT);
303 j->flags &= ~JF_PERSIST;
305 if (create_jail(j) < 0)
308 printf("%d\n", j->jid);
309 if (verbose >= 0 && (j->name || verbose > 0))
310 jail_note(j, "created\n");
311 dep_done(j, DF_LIGHT);
318 * Collect exec arguments. Internal commands for network and
319 * mounting build their own argument lists.
321 comstring = j->comstring;
327 val = alloca(strlen(comstring->s) + 1);
328 strcpy(val, comstring->s);
331 while ((p = strchr(cs, ' ')) != NULL && strlen(p) > 1) {
332 if (extrap == NULL) {
340 argv = alloca((8 + argc) * sizeof(char *));
341 *(const char **)&argv[0] = _PATH_IFCONFIG;
342 if ((cs = strchr(val, '|'))) {
343 argv[1] = alloca(cs - val + 1);
344 strlcpy(argv[1], val, cs - val + 1);
347 *(const char **)&argv[1] =
348 string_param(j->intparams[IP_INTERFACE]);
351 *(const char **)&argv[2] = "inet";
352 if (!(cs = strchr(addr, '/'))) {
354 *(const char **)&argv[4] = "netmask";
355 *(const char **)&argv[5] = "255.255.255.255";
357 } else if (strchr(cs + 1, '.')) {
358 argv[3] = alloca(cs - addr + 1);
359 strlcpy(argv[3], addr, cs - addr + 1);
360 *(const char **)&argv[4] = "netmask";
361 *(const char **)&argv[5] = cs + 1;
369 for (cs = strtok(extrap, " "); cs; cs = strtok(NULL, " ")) {
370 size_t len = strlen(cs) + 1;
371 argv[argc] = alloca(len);
372 strlcpy(argv[argc++], cs, len);
376 *(const char **)&argv[argc] = down ? "-alias" : "alias";
377 argv[argc + 1] = NULL;
384 val = alloca(strlen(comstring->s) + 1);
385 strcpy(val, comstring->s);
388 while ((p = strchr(cs, ' ')) != NULL && strlen(p) > 1) {
389 if (extrap == NULL) {
397 argv = alloca((8 + argc) * sizeof(char *));
398 *(const char **)&argv[0] = _PATH_IFCONFIG;
399 if ((cs = strchr(val, '|'))) {
400 argv[1] = alloca(cs - val + 1);
401 strlcpy(argv[1], val, cs - val + 1);
404 *(const char **)&argv[1] =
405 string_param(j->intparams[IP_INTERFACE]);
408 *(const char **)&argv[2] = "inet6";
410 if (!(cs = strchr(addr, '/'))) {
411 *(const char **)&argv[4] = "prefixlen";
412 *(const char **)&argv[5] = "128";
418 for (cs = strtok(extrap, " "); cs; cs = strtok(NULL, " ")) {
419 size_t len = strlen(cs) + 1;
420 argv[argc] = alloca(len);
421 strlcpy(argv[argc++], cs, len);
425 *(const char **)&argv[argc] = down ? "-alias" : "alias";
426 argv[argc + 1] = NULL;
430 case IP_VNET_INTERFACE:
431 argv = alloca(5 * sizeof(char *));
432 *(const char **)&argv[0] = _PATH_IFCONFIG;
433 argv[1] = comstring->s;
434 *(const char **)&argv[2] = down ? "-vnet" : "vnet";
435 jidstr = string_param(j->intparams[KP_JID]);
436 *(const char **)&argv[3] =
437 jidstr ? jidstr : string_param(j->intparams[KP_NAME]);
442 case IP__MOUNT_FROM_FSTAB:
443 argv = alloca(8 * sizeof(char *));
444 comcs = alloca(comstring->len + 1);
445 strcpy(comcs, comstring->s);
447 for (cs = strtok(comcs, " \t\f\v\r\n"); cs && argc < 4;
448 cs = strtok(NULL, " \t\f\v\r\n"))
453 jail_warnx(j, "%s: %s: missing information",
454 j->intparams[comparam]->name, comstring->s);
457 if (check_path(j, j->intparams[comparam]->name, argv[1], 0,
458 down ? argv[2] : NULL) < 0)
463 *(const char **)&argv[0] = "/sbin/umount";
470 *(const char **)&argv[3] = "-o";
476 *(const char **)&argv[0] = _PATH_MOUNT;
478 *(const char **)&argv[1] = "-t";
482 argv = alloca(7 * sizeof(char *));
483 path = string_param(j->intparams[KP_PATH]);
485 jail_warnx(j, "mount.devfs: no path");
488 devpath = alloca(strlen(path) + 5);
489 sprintf(devpath, "%s/dev", path);
490 if (check_path(j, "mount.devfs", devpath, 0,
491 down ? "devfs" : NULL) < 0)
494 *(const char **)&argv[0] = "/sbin/umount";
498 *(const char **)&argv[0] = _PATH_MOUNT;
499 *(const char **)&argv[1] = "-t";
500 *(const char **)&argv[2] = "devfs";
501 ruleset = string_param(j->intparams[KP_DEVFS_RULESET]);
503 ruleset = "4"; /* devfsrules_jail */
504 argv[3] = alloca(11 + strlen(ruleset));
505 sprintf(argv[3], "-oruleset=%s", ruleset);
506 *(const char **)&argv[4] = ".";
512 case IP_MOUNT_FDESCFS:
513 argv = alloca(7 * sizeof(char *));
514 path = string_param(j->intparams[KP_PATH]);
516 jail_warnx(j, "mount.fdescfs: no path");
519 devpath = alloca(strlen(path) + 8);
520 sprintf(devpath, "%s/dev/fd", path);
521 if (check_path(j, "mount.fdescfs", devpath, 0,
522 down ? "fdescfs" : NULL) < 0)
525 *(const char **)&argv[0] = "/sbin/umount";
529 *(const char **)&argv[0] = _PATH_MOUNT;
530 *(const char **)&argv[1] = "-t";
531 *(const char **)&argv[2] = "fdescfs";
532 *(const char **)&argv[3] = ".";
538 case IP_MOUNT_PROCFS:
539 argv = alloca(7 * sizeof(char *));
540 path = string_param(j->intparams[KP_PATH]);
542 jail_warnx(j, "mount.procfs: no path");
545 devpath = alloca(strlen(path) + 6);
546 sprintf(devpath, "%s/proc", path);
547 if (check_path(j, "mount.procfs", devpath, 0,
548 down ? "procfs" : NULL) < 0)
551 *(const char **)&argv[0] = "/sbin/umount";
555 *(const char **)&argv[0] = _PATH_MOUNT;
556 *(const char **)&argv[1] = "-t";
557 *(const char **)&argv[2] = "procfs";
558 *(const char **)&argv[3] = ".";
566 goto default_command;
568 TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq)
570 argv = alloca((argc + 1) * sizeof(char *));
572 TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq)
575 j->comstring = &dummystring;
580 if ((cs = strpbrk(comstring->s, "!\"$&'()*;<>?[\\]`{|}~")) &&
581 !(cs[0] == '&' && cs[1] == '\0')) {
582 argv = alloca(4 * sizeof(char *));
583 *(const char **)&argv[0] = _PATH_BSHELL;
584 *(const char **)&argv[1] = "-c";
585 argv[2] = comstring->s;
592 comcs = alloca(comstring->len + 1);
593 strcpy(comcs, comstring->s);
595 for (cs = strtok(comcs, " \t\f\v\r\n"); cs;
596 cs = strtok(NULL, " \t\f\v\r\n"))
598 argv = alloca((argc + 1) * sizeof(char *));
599 strcpy(comcs, comstring->s);
601 for (cs = strtok(comcs, " \t\f\v\r\n"); cs;
602 cs = strtok(NULL, " \t\f\v\r\n"))
610 if (int_param(j->intparams[IP_EXEC_TIMEOUT], &timeout) &&
612 clock_gettime(CLOCK_REALTIME, &j->timeout);
613 j->timeout.tv_sec += timeout;
615 j->timeout.tv_sec = 0;
617 injail = comparam == IP_EXEC_START || comparam == IP_COMMAND ||
618 comparam == IP_EXEC_STOP;
619 clean = bool_param(j->intparams[IP_EXEC_CLEAN]);
620 username = string_param(j->intparams[injail
621 ? IP_EXEC_JAIL_USER : IP_EXEC_SYSTEM_USER]);
622 sjuser = bool_param(j->intparams[IP_EXEC_SYSTEM_JAIL_USER]);
626 (conslog = string_param(j->intparams[IP_EXEC_CONSOLELOG]))) {
627 if (check_path(j, "exec.consolelog", conslog, 1, NULL) < 0)
630 open(conslog, O_WRONLY | O_CREAT | O_APPEND, DEFFILEMODE);
632 jail_warnx(j, "open %s: %s", conslog, strerror(errno));
638 for (i = 0; argv[i]; i++)
639 comlen += strlen(argv[i]) + 1;
640 j->comline = cs = emalloc(comlen);
641 for (i = 0; argv[i]; i++) {
644 cs += strlen(argv[i]) + 1;
649 jail_note(j, "run command%s%s%s: %s\n",
650 injail ? " in jail" : "", username ? " as " : "",
651 username ? username : "", j->comline);
657 if (bg || !add_proc(j, pid)) {
669 /* Set up the environment and run the command */
672 if ((clean || username) && injail && sjuser &&
673 get_user_info(j, username, &pwd, &lcap) < 0)
676 /* jail_attach won't chdir along with its chroot. */
677 path = string_param(j->intparams[KP_PATH]);
678 if (path && chdir(path) < 0) {
679 jail_warnx(j, "chdir %s: %s", path, strerror(errno));
682 if (int_param(j->intparams[IP_EXEC_FIB], &fib) &&
684 jail_warnx(j, "setfib: %s", strerror(errno));
687 if (jail_attach(j->jid) < 0) {
688 jail_warnx(j, "jail_attach: %s", strerror(errno));
692 if (clean || username) {
693 if (!(injail && sjuser) &&
694 get_user_info(j, username, &pwd, &lcap) < 0)
697 term = getenv("TERM");
699 setenv("PATH", "/bin:/usr/bin", 0);
701 setenv("TERM", term, 1);
703 if (setgid(pwd->pw_gid) < 0) {
704 jail_warnx(j, "setgid %d: %s", pwd->pw_gid,
708 if (setusercontext(lcap, pwd, pwd->pw_uid, username
709 ? LOGIN_SETALL & ~LOGIN_SETGROUP & ~LOGIN_SETLOGIN
710 : LOGIN_SETPATH | LOGIN_SETENV) < 0) {
711 jail_warnx(j, "setusercontext %s: %s", pwd->pw_name,
716 setenv("USER", pwd->pw_name, 1);
717 setenv("HOME", pwd->pw_dir, 1);
719 *pwd->pw_shell ? pwd->pw_shell : _PATH_BSHELL, 1);
720 if (clean && chdir(pwd->pw_dir) < 0) {
721 jail_warnx(j, "chdir %s: %s",
722 pwd->pw_dir, strerror(errno));
728 if (consfd != 0 && (dup2(consfd, 1) < 0 || dup2(consfd, 2) < 0)) {
729 jail_warnx(j, "exec.consolelog: %s", strerror(errno));
733 execvp(argv[0], argv);
734 jail_warnx(j, "exec %s: %s", argv[0], strerror(errno));
739 * Add a process to the hash, tied to a jail.
742 add_proc(struct cfjail *j, pid_t pid)
748 if (!kq && (kq = kqueue()) < 0)
750 EV_SET(&ke, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
751 if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
756 ph = emalloc(sizeof(struct phash));
759 LIST_INSERT_HEAD(&phash[pid % PHASH_SIZE], ph, le);
761 j->flags |= JF_SLEEPQ;
762 if (j->timeout.tv_sec == 0)
763 requeue(j, &sleeping);
765 /* File the jail in the sleep queue acording to its timeout. */
766 TAILQ_REMOVE(j->queue, j, tq);
767 TAILQ_FOREACH(tj, &sleeping, tq) {
768 if (!tj->timeout.tv_sec ||
769 j->timeout.tv_sec < tj->timeout.tv_sec ||
770 (j->timeout.tv_sec == tj->timeout.tv_sec &&
771 j->timeout.tv_nsec <= tj->timeout.tv_nsec)) {
772 TAILQ_INSERT_BEFORE(tj, j, tq);
777 TAILQ_INSERT_TAIL(&sleeping, j, tq);
778 j->queue = &sleeping;
784 * Remove any processes from the hash that correspond to a jail.
787 clear_procs(struct cfjail *j)
790 struct phash *ph, *tph;
794 for (i = 0; i < PHASH_SIZE; i++)
795 LIST_FOREACH_SAFE(ph, &phash[i], le, tph)
797 EV_SET(&ke, ph->pid, EVFILT_PROC, EV_DELETE,
799 (void)kevent(kq, &ke, 1, NULL, 0, NULL);
806 * Find the jail that corresponds to an exited process.
808 static struct cfjail *
814 LIST_FOREACH(ph, &phash[pid % PHASH_SIZE], le)
815 if (ph->pid == pid) {
819 return --j->nprocs ? NULL : j;
825 * Send SIGTERM to all processes in a jail and wait for them to die.
828 term_procs(struct cfjail *j)
830 struct kinfo_proc *ki;
831 int i, noted, pcnt, timeout;
835 if (!int_param(j->intparams[IP_STOP_TIMEOUT], &timeout))
836 timeout = DEFAULT_STOP_TIMEOUT;
837 else if (timeout == 0)
841 kd = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL);
846 ki = kvm_getprocs(kd, KERN_PROC_PROC, 0, &pcnt);
850 for (i = 0; i < pcnt; i++)
851 if (ki[i].ki_jid == j->jid &&
852 kill(ki[i].ki_pid, SIGTERM) == 0) {
853 (void)add_proc(j, ki[i].ki_pid);
857 jail_note(j, "sent SIGTERM to:");
859 printf(" %d", ki[i].ki_pid);
865 clock_gettime(CLOCK_REALTIME, &j->timeout);
866 j->timeout.tv_sec += timeout;
873 * Look up a user in the passwd and login.conf files.
876 get_user_info(struct cfjail *j, const char *username,
877 const struct passwd **pwdp, login_cap_t **lcapp)
879 const struct passwd *pwd;
881 *pwdp = pwd = username ? getpwnam(username) : getpwuid(getuid());
884 jail_warnx(j, "getpwnam%s%s: %s", username ? " " : "",
885 username ? username : "", strerror(errno));
887 jail_warnx(j, "%s: no such user", username);
889 jail_warnx(j, "unknown uid %d", getuid());
892 *lcapp = login_getpwclass(pwd);
893 if (*lcapp == NULL) {
894 jail_warnx(j, "getpwclass %s: %s", pwd->pw_name,
898 /* Set the groups while the group file is still available */
899 if (initgroups(pwd->pw_name, pwd->pw_gid) < 0) {
900 jail_warnx(j, "initgroups %s: %s", pwd->pw_name,
908 * Make sure a mount or consolelog path is a valid absolute pathname
912 check_path(struct cfjail *j, const char *pname, const char *path, int isfile,
913 const char *umount_type)
915 struct stat st, mpst;
918 const char *jailpath;
921 if (path[0] != '/') {
922 jail_warnx(j, "%s: %s: not an absolute pathname",
927 * Only check for symlinks in components below the jail's path,
928 * since that's where the security risk lies.
930 jailpath = string_param(j->intparams[KP_PATH]);
931 if (jailpath == NULL)
933 jplen = strlen(jailpath);
934 if (!strncmp(path, jailpath, jplen) && path[jplen] == '/') {
935 tpath = alloca(strlen(path) + 1);
937 for (p = tpath + jplen; p != NULL; ) {
938 p = strchr(p + 1, '/');
941 if (lstat(tpath, &st) < 0) {
942 if (errno == ENOENT && isfile && !p)
944 jail_warnx(j, "%s: %s: %s", pname, tpath,
948 if (S_ISLNK(st.st_mode)) {
949 jail_warnx(j, "%s: %s is a symbolic link",
957 if (umount_type != NULL) {
958 if (stat(path, &st) < 0 || statfs(path, &stfs) < 0) {
959 jail_warnx(j, "%s: %s: %s", pname, path,
963 if (stat(stfs.f_mntonname, &mpst) < 0) {
964 jail_warnx(j, "%s: %s: %s", pname, stfs.f_mntonname,
968 if (st.st_ino != mpst.st_ino) {
969 jail_warnx(j, "%s: %s: not a mount point",
973 if (strcmp(stfs.f_fstypename, umount_type)) {
974 jail_warnx(j, "%s: %s: not a %s mount",
975 pname, path, umount_type);