2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2011 James Gritton
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 #include <sys/types.h>
31 #include <sys/cpuset.h>
32 #include <sys/event.h>
33 #include <sys/mount.h>
35 #include <sys/sysctl.h>
43 #include <login_cap.h>
55 #define DEFAULT_STOP_TIMEOUT 10
56 #define PHASH_SIZE 256
58 LIST_HEAD(phhead, phash);
68 extern char **environ;
70 static int run_command(struct cfjail *j);
71 static int add_proc(struct cfjail *j, pid_t pid);
72 static void clear_procs(struct cfjail *j);
73 static struct cfjail *find_proc(pid_t pid);
74 static int term_procs(struct cfjail *j);
75 static int get_user_info(struct cfjail *j, const char *username,
76 const struct passwd **pwdp, login_cap_t **lcapp);
77 static int check_path(struct cfjail *j, const char *pname, const char *path,
78 int isfile, const char *umount_type);
80 static struct cfjails sleeping = TAILQ_HEAD_INITIALIZER(sleeping);
81 static struct cfjails runnable = TAILQ_HEAD_INITIALIZER(runnable);
82 static struct cfstring dummystring = { .len = 1 };
83 static struct phhead phash[PHASH_SIZE];
89 static cpusetid_t setid = CPUSET_INVALID;
92 /* Only try to get the cpuset once. */
93 if (error == 0 && setid == CPUSET_INVALID)
94 error = cpuset_getid(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, &setid);
96 return (CPUSET_INVALID);
101 * Run the next command associated with a jail.
104 next_command(struct cfjail *j)
106 enum intparam comparam;
107 int create_failed, stopping;
109 if (paralimit == 0) {
110 if (j->flags & JF_FROM_RUNQ)
111 requeue_head(j, &runnable);
113 requeue(j, &runnable);
116 j->flags &= ~JF_FROM_RUNQ;
117 create_failed = (j->flags & (JF_STOP | JF_FAILED)) == JF_FAILED;
118 stopping = (j->flags & JF_STOP) != 0;
119 comparam = *j->comparam;
121 if (j->comstring == NULL) {
122 j->comparam += create_failed ? -1 : 1;
123 switch ((comparam = *j->comparam)) {
127 if (!bool_param(j->intparams[IP_MOUNT_DEVFS]))
129 j->comstring = &dummystring;
131 case IP_MOUNT_FDESCFS:
132 if (!bool_param(j->intparams[IP_MOUNT_FDESCFS]))
134 j->comstring = &dummystring;
136 case IP_MOUNT_PROCFS:
137 if (!bool_param(j->intparams[IP_MOUNT_PROCFS]))
139 j->comstring = &dummystring;
142 case IP_STOP_TIMEOUT:
143 j->comstring = &dummystring;
146 if (j->intparams[comparam] == NULL)
148 j->comstring = create_failed || (stopping &&
149 (j->intparams[comparam]->flags & PF_REV))
150 ? TAILQ_LAST(&j->intparams[comparam]->val,
152 : TAILQ_FIRST(&j->intparams[comparam]->val);
155 j->comstring = j->comstring == &dummystring ? NULL :
156 create_failed || (stopping &&
157 (j->intparams[comparam]->flags & PF_REV))
158 ? TAILQ_PREV(j->comstring, cfstrings, tq)
159 : TAILQ_NEXT(j->comstring, tq);
161 if (j->comstring == NULL || j->comstring->len == 0 ||
162 (create_failed && (comparam == IP_EXEC_PRESTART ||
163 comparam == IP_EXEC_CREATED || comparam == IP_EXEC_START ||
164 comparam == IP_COMMAND || comparam == IP_EXEC_POSTSTART ||
165 comparam == IP_EXEC_PREPARE)))
167 switch (run_command(j)) {
178 * Check command exit status
181 finish_command(struct cfjail *j)
186 if (!(j->flags & JF_SLEEPQ))
188 j->flags &= ~JF_SLEEPQ;
189 if (*j->comparam == IP_STOP_TIMEOUT) {
190 j->flags &= ~JF_TIMEOUT;
195 if (!TAILQ_EMPTY(&runnable)) {
196 rj = TAILQ_FIRST(&runnable);
197 rj->flags |= JF_FROM_RUNQ;
201 if (j->flags & JF_TIMEOUT) {
202 j->flags &= ~JF_TIMEOUT;
203 if (*j->comparam != IP_STOP_TIMEOUT) {
204 jail_warnx(j, "%s: timed out", j->comline);
207 } else if (verbose > 0)
208 jail_note(j, "timed out\n");
209 } else if (j->pstatus != 0) {
210 if (WIFSIGNALED(j->pstatus))
211 jail_warnx(j, "%s: exited on signal %d",
212 j->comline, WTERMSIG(j->pstatus));
214 jail_warnx(j, "%s: failed", j->comline);
225 * Check for finished processes or timeouts.
228 next_proc(int nonblock)
232 struct timespec *tsp;
235 if (!TAILQ_EMPTY(&sleeping)) {
238 if ((j = TAILQ_FIRST(&sleeping)) && j->timeout.tv_sec) {
239 clock_gettime(CLOCK_REALTIME, &ts);
240 ts.tv_sec = j->timeout.tv_sec - ts.tv_sec;
241 ts.tv_nsec = j->timeout.tv_nsec - ts.tv_nsec;
242 if (ts.tv_nsec < 0) {
244 ts.tv_nsec += 1000000000;
247 (ts.tv_sec == 0 && ts.tv_nsec == 0)) {
248 j->flags |= JF_TIMEOUT;
259 switch (kevent(kq, NULL, 0, &ke, 1, tsp)) {
266 j = TAILQ_FIRST(&sleeping);
267 j->flags |= JF_TIMEOUT;
273 (void)waitpid(ke.ident, NULL, WNOHANG);
274 if ((j = find_proc(ke.ident))) {
275 j->pstatus = ke.data;
285 * Run a single command for a jail, possibly inside the jail.
288 run_command(struct cfjail *j)
290 const struct passwd *pwd;
291 const struct cfstring *comstring, *s;
294 char *acs, *cs, *comcs, *devpath;
295 const char *jidstr, *conslog, *path, *ruleset, *term, *username;
296 enum intparam comparam;
300 int argc, bg, clean, consfd, down, fib, i, injail, sjuser, timeout;
301 #if defined(INET) || defined(INET6)
302 char *addr, *extrap, *p, *val;
305 static char *cleanenv;
307 /* Perform some operations that aren't actually commands */
308 comparam = *j->comparam;
309 down = j->flags & (JF_STOP | JF_FAILED);
311 case IP_STOP_TIMEOUT:
312 return term_procs(j);
316 if (jail_remove(j->jid) < 0 && errno == EPERM) {
317 jail_warnx(j, "jail_remove: %s",
321 if (verbose > 0 || (verbose == 0 && (j->flags & JF_STOP
322 ? note_remove : j->name != NULL)))
323 jail_note(j, "removed\n");
325 if (j->flags & JF_STOP)
326 dep_done(j, DF_LIGHT);
328 j->flags &= ~JF_PERSIST;
330 if (create_jail(j) < 0)
333 printf("%d\n", j->jid);
334 if (verbose >= 0 && (j->name || verbose > 0))
335 jail_note(j, "created\n");
336 dep_done(j, DF_LIGHT);
343 * Collect exec arguments. Internal commands for network and
344 * mounting build their own argument lists.
346 comstring = j->comstring;
352 val = alloca(strlen(comstring->s) + 1);
353 strcpy(val, comstring->s);
356 while ((p = strchr(cs, ' ')) != NULL && strlen(p) > 1) {
357 if (extrap == NULL) {
365 argv = alloca((8 + argc) * sizeof(char *));
366 argv[0] = _PATH_IFCONFIG;
367 if ((cs = strchr(val, '|'))) {
368 argv[1] = acs = alloca(cs - val + 1);
369 strlcpy(acs, val, cs - val + 1);
372 argv[1] = string_param(j->intparams[IP_INTERFACE]);
376 if (!(cs = strchr(addr, '/'))) {
379 argv[5] = "255.255.255.255";
381 } else if (strchr(cs + 1, '.')) {
382 argv[3] = acs = alloca(cs - addr + 1);
383 strlcpy(acs, addr, cs - addr + 1);
392 if (!down && extrap != NULL) {
393 for (cs = strtok(extrap, " "); cs;
394 cs = strtok(NULL, " ")) {
395 size_t len = strlen(cs) + 1;
396 argv[argc++] = acs = alloca(len);
397 strlcpy(acs, cs, len);
401 argv[argc] = down ? "-alias" : "alias";
402 argv[argc + 1] = NULL;
409 val = alloca(strlen(comstring->s) + 1);
410 strcpy(val, comstring->s);
413 while ((p = strchr(cs, ' ')) != NULL && strlen(p) > 1) {
414 if (extrap == NULL) {
422 argv = alloca((8 + argc) * sizeof(char *));
423 argv[0] = _PATH_IFCONFIG;
424 if ((cs = strchr(val, '|'))) {
425 argv[1] = acs = alloca(cs - val + 1);
426 strlcpy(acs, val, cs - val + 1);
429 argv[1] = string_param(j->intparams[IP_INTERFACE]);
434 if (!(cs = strchr(addr, '/'))) {
435 argv[4] = "prefixlen";
441 if (!down && extrap != NULL) {
442 for (cs = strtok(extrap, " "); cs;
443 cs = strtok(NULL, " ")) {
444 size_t len = strlen(cs) + 1;
445 argv[argc++] = acs = alloca(len);
446 strlcpy(acs, cs, len);
450 argv[argc] = down ? "-alias" : "alias";
451 argv[argc + 1] = NULL;
455 case IP_VNET_INTERFACE:
456 argv = alloca(5 * sizeof(char *));
457 argv[0] = _PATH_IFCONFIG;
458 argv[1] = comstring->s;
459 argv[2] = down ? "-vnet" : "vnet";
460 jidstr = string_param(j->intparams[KP_JID]);
461 argv[3] = jidstr ? jidstr : string_param(j->intparams[KP_NAME]);
466 case IP__MOUNT_FROM_FSTAB:
467 argv = alloca(8 * sizeof(char *));
468 comcs = alloca(comstring->len + 1);
469 strcpy(comcs, comstring->s);
471 for (cs = strtok(comcs, " \t\f\v\r\n"); cs && argc < 4;
472 cs = strtok(NULL, " \t\f\v\r\n")) {
473 if (argc <= 1 && strunvis(cs, cs) < 0) {
474 jail_warnx(j, "%s: %s: fstab parse error",
475 j->intparams[comparam]->name, comstring->s);
483 jail_warnx(j, "%s: %s: missing information",
484 j->intparams[comparam]->name, comstring->s);
487 if (check_path(j, j->intparams[comparam]->name, argv[1], 0,
488 down ? argv[2] : NULL) < 0)
493 argv[0] = "/sbin/umount";
506 argv[0] = _PATH_MOUNT;
512 argv = alloca(7 * sizeof(char *));
513 path = string_param(j->intparams[KP_PATH]);
515 jail_warnx(j, "mount.devfs: no jail root path defined");
518 devpath = alloca(strlen(path) + 5);
519 sprintf(devpath, "%s/dev", path);
520 if (check_path(j, "mount.devfs", devpath, 0,
521 down ? "devfs" : NULL) < 0)
524 argv[0] = "/sbin/umount";
528 argv[0] = _PATH_MOUNT;
531 ruleset = string_param(j->intparams[KP_DEVFS_RULESET]);
533 ruleset = "4"; /* devfsrules_jail */
534 argv[3] = acs = alloca(11 + strlen(ruleset));
535 sprintf(acs, "-oruleset=%s", ruleset);
542 case IP_MOUNT_FDESCFS:
543 argv = alloca(7 * sizeof(char *));
544 path = string_param(j->intparams[KP_PATH]);
546 jail_warnx(j, "mount.fdescfs: no jail root path defined");
549 devpath = alloca(strlen(path) + 8);
550 sprintf(devpath, "%s/dev/fd", path);
551 if (check_path(j, "mount.fdescfs", devpath, 0,
552 down ? "fdescfs" : NULL) < 0)
555 argv[0] = "/sbin/umount";
559 argv[0] = _PATH_MOUNT;
568 case IP_MOUNT_PROCFS:
569 argv = alloca(7 * sizeof(char *));
570 path = string_param(j->intparams[KP_PATH]);
572 jail_warnx(j, "mount.procfs: no jail root path defined");
575 devpath = alloca(strlen(path) + 6);
576 sprintf(devpath, "%s/proc", path);
577 if (check_path(j, "mount.procfs", devpath, 0,
578 down ? "procfs" : NULL) < 0)
581 argv[0] = "/sbin/umount";
585 argv[0] = _PATH_MOUNT;
596 goto default_command;
598 TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq)
600 argv = alloca((argc + 1) * sizeof(char *));
602 TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq)
605 j->comstring = &dummystring;
610 if ((cs = strpbrk(comstring->s, "!\"$&'()*;<>?[\\]`{|}~")) &&
611 !(cs[0] == '&' && cs[1] == '\0')) {
612 argv = alloca(4 * sizeof(char *));
613 argv[0] = _PATH_BSHELL;
615 argv[2] = comstring->s;
622 comcs = alloca(comstring->len + 1);
623 strcpy(comcs, comstring->s);
625 for (cs = strtok(comcs, " \t\f\v\r\n"); cs;
626 cs = strtok(NULL, " \t\f\v\r\n"))
628 argv = alloca((argc + 1) * sizeof(char *));
629 strcpy(comcs, comstring->s);
631 for (cs = strtok(comcs, " \t\f\v\r\n"); cs;
632 cs = strtok(NULL, " \t\f\v\r\n"))
640 if (int_param(j->intparams[IP_EXEC_TIMEOUT], &timeout) &&
642 clock_gettime(CLOCK_REALTIME, &j->timeout);
643 j->timeout.tv_sec += timeout;
645 j->timeout.tv_sec = 0;
647 injail = comparam == IP_EXEC_START || comparam == IP_COMMAND ||
648 comparam == IP_EXEC_STOP;
650 setid = root_cpuset_id();
652 setid = CPUSET_INVALID;
653 clean = bool_param(j->intparams[IP_EXEC_CLEAN]);
654 username = string_param(j->intparams[injail
655 ? IP_EXEC_JAIL_USER : IP_EXEC_SYSTEM_USER]);
656 sjuser = bool_param(j->intparams[IP_EXEC_SYSTEM_JAIL_USER]);
660 (conslog = string_param(j->intparams[IP_EXEC_CONSOLELOG]))) {
661 if (check_path(j, "exec.consolelog", conslog, 1, NULL) < 0)
664 open(conslog, O_WRONLY | O_CREAT | O_APPEND, DEFFILEMODE);
666 jail_warnx(j, "open %s: %s", conslog, strerror(errno));
672 for (i = 0; argv[i]; i++)
673 comlen += strlen(argv[i]) + 1;
674 j->comline = cs = emalloc(comlen);
675 for (i = 0; argv[i]; i++) {
678 cs += strlen(argv[i]) + 1;
683 jail_note(j, "run command%s%s%s: %s\n",
684 injail ? " in jail" : "", username ? " as " : "",
685 username ? username : "", j->comline);
691 if (bg || !add_proc(j, pid)) {
703 /* Set up the environment and run the command */
706 if ((clean || username) && injail && sjuser &&
707 get_user_info(j, username, &pwd, &lcap) < 0)
710 /* jail_attach won't chdir along with its chroot. */
711 path = string_param(j->intparams[KP_PATH]);
712 if (path && chdir(path) < 0) {
713 jail_warnx(j, "chdir %s: %s", path, strerror(errno));
716 if (int_param(j->intparams[IP_EXEC_FIB], &fib) &&
718 jail_warnx(j, "setfib: %s", strerror(errno));
723 * We wouldn't have specialized our affinity, so just setid to
724 * root. We do this prior to attaching to avoid the kernel
725 * having to create a transient cpuset that we'll promptly
726 * free up with a reset to the jail's cpuset.
728 * This is just a best-effort to use as wide of mask as
731 if (setid != CPUSET_INVALID)
732 (void)cpuset_setid(CPU_WHICH_PID, -1, setid);
734 if (jail_attach(j->jid) < 0) {
735 jail_warnx(j, "jail_attach: %s", strerror(errno));
739 if (clean || username) {
740 if (!(injail && sjuser) &&
741 get_user_info(j, username, &pwd, &lcap) < 0)
744 term = getenv("TERM");
746 setenv("PATH", "/bin:/usr/bin", 0);
748 setenv("TERM", term, 1);
750 if (setgid(pwd->pw_gid) < 0) {
751 jail_warnx(j, "setgid %d: %s", pwd->pw_gid,
755 if (setusercontext(lcap, pwd, pwd->pw_uid, username
756 ? LOGIN_SETALL & ~LOGIN_SETGROUP & ~LOGIN_SETLOGIN
757 : LOGIN_SETPATH | LOGIN_SETENV) < 0) {
758 jail_warnx(j, "setusercontext %s: %s", pwd->pw_name,
763 setenv("USER", pwd->pw_name, 1);
764 setenv("HOME", pwd->pw_dir, 1);
766 *pwd->pw_shell ? pwd->pw_shell : _PATH_BSHELL, 1);
767 if (clean && chdir(pwd->pw_dir) < 0) {
768 jail_warnx(j, "chdir %s: %s",
769 pwd->pw_dir, strerror(errno));
775 if (consfd != 0 && (dup2(consfd, 1) < 0 || dup2(consfd, 2) < 0)) {
776 jail_warnx(j, "exec.consolelog: %s", strerror(errno));
780 execvp(argv[0], __DECONST(char *const*, argv));
781 jail_warnx(j, "exec %s: %s", argv[0], strerror(errno));
786 * Add a process to the hash, tied to a jail.
789 add_proc(struct cfjail *j, pid_t pid)
795 if (!kq && (kq = kqueue()) < 0)
797 EV_SET(&ke, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
798 if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
803 ph = emalloc(sizeof(struct phash));
806 LIST_INSERT_HEAD(&phash[pid % PHASH_SIZE], ph, le);
808 j->flags |= JF_SLEEPQ;
809 if (j->timeout.tv_sec == 0)
810 requeue(j, &sleeping);
812 /* File the jail in the sleep queue according to its timeout. */
813 TAILQ_REMOVE(j->queue, j, tq);
814 TAILQ_FOREACH(tj, &sleeping, tq) {
815 if (!tj->timeout.tv_sec ||
816 j->timeout.tv_sec < tj->timeout.tv_sec ||
817 (j->timeout.tv_sec == tj->timeout.tv_sec &&
818 j->timeout.tv_nsec <= tj->timeout.tv_nsec)) {
819 TAILQ_INSERT_BEFORE(tj, j, tq);
824 TAILQ_INSERT_TAIL(&sleeping, j, tq);
825 j->queue = &sleeping;
831 * Remove any processes from the hash that correspond to a jail.
834 clear_procs(struct cfjail *j)
837 struct phash *ph, *tph;
841 for (i = 0; i < PHASH_SIZE; i++)
842 LIST_FOREACH_SAFE(ph, &phash[i], le, tph)
844 EV_SET(&ke, ph->pid, EVFILT_PROC, EV_DELETE,
846 (void)kevent(kq, &ke, 1, NULL, 0, NULL);
853 * Find the jail that corresponds to an exited process.
855 static struct cfjail *
861 LIST_FOREACH(ph, &phash[pid % PHASH_SIZE], le)
862 if (ph->pid == pid) {
866 return --j->nprocs ? NULL : j;
872 * Send SIGTERM to all processes in a jail and wait for them to die.
875 term_procs(struct cfjail *j)
877 struct kinfo_proc *ki;
878 int i, noted, pcnt, timeout;
882 if (!int_param(j->intparams[IP_STOP_TIMEOUT], &timeout))
883 timeout = DEFAULT_STOP_TIMEOUT;
884 else if (timeout == 0)
888 kd = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL);
893 ki = kvm_getprocs(kd, KERN_PROC_PROC, 0, &pcnt);
897 for (i = 0; i < pcnt; i++)
898 if (ki[i].ki_jid == j->jid &&
899 kill(ki[i].ki_pid, SIGTERM) == 0) {
900 (void)add_proc(j, ki[i].ki_pid);
904 jail_note(j, "sent SIGTERM to:");
906 printf(" %d", ki[i].ki_pid);
912 clock_gettime(CLOCK_REALTIME, &j->timeout);
913 j->timeout.tv_sec += timeout;
920 * Look up a user in the passwd and login.conf files.
923 get_user_info(struct cfjail *j, const char *username,
924 const struct passwd **pwdp, login_cap_t **lcapp)
926 const struct passwd *pwd;
929 *pwdp = pwd = username ? getpwnam(username) : getpwuid(getuid());
932 jail_warnx(j, "getpwnam%s%s: %s", username ? " " : "",
933 username ? username : "", strerror(errno));
935 jail_warnx(j, "%s: no such user", username);
937 jail_warnx(j, "unknown uid %d", getuid());
940 *lcapp = login_getpwclass(pwd);
941 if (*lcapp == NULL) {
942 jail_warnx(j, "getpwclass %s: %s", pwd->pw_name,
946 /* Set the groups while the group file is still available */
947 if (initgroups(pwd->pw_name, pwd->pw_gid) < 0) {
948 jail_warnx(j, "initgroups %s: %s", pwd->pw_name,
956 * Make sure a mount or consolelog path is a valid absolute pathname
960 check_path(struct cfjail *j, const char *pname, const char *path, int isfile,
961 const char *umount_type)
963 struct stat st, mpst;
966 const char *jailpath;
969 if (path[0] != '/') {
970 jail_warnx(j, "%s: %s: not an absolute pathname",
975 * Only check for symlinks in components below the jail's path,
976 * since that's where the security risk lies.
978 jailpath = string_param(j->intparams[KP_PATH]);
979 if (jailpath == NULL)
981 jplen = strlen(jailpath);
982 if (!strncmp(path, jailpath, jplen) && path[jplen] == '/') {
983 tpath = alloca(strlen(path) + 1);
985 for (p = tpath + jplen; p != NULL; ) {
986 p = strchr(p + 1, '/');
989 if (lstat(tpath, &st) < 0) {
990 if (errno == ENOENT && isfile && !p)
992 jail_warnx(j, "%s: %s: %s", pname, tpath,
996 if (S_ISLNK(st.st_mode)) {
997 jail_warnx(j, "%s: %s is a symbolic link",
1005 if (umount_type != NULL) {
1006 if (stat(path, &st) < 0 || statfs(path, &stfs) < 0) {
1007 jail_warnx(j, "%s: %s: %s", pname, path,
1011 if (stat(stfs.f_mntonname, &mpst) < 0) {
1012 jail_warnx(j, "%s: %s: %s", pname, stfs.f_mntonname,
1016 if (st.st_ino != mpst.st_ino) {
1017 jail_warnx(j, "%s: %s: not a mount point",
1021 if (strcmp(stfs.f_fstypename, umount_type)) {
1022 jail_warnx(j, "%s: %s: not a %s mount",
1023 pname, path, umount_type);