2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
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 __FBSDID("$FreeBSD$");
32 #include <sys/types.h>
33 #include <sys/cpuset.h>
34 #include <sys/event.h>
35 #include <sys/mount.h>
37 #include <sys/sysctl.h>
45 #include <login_cap.h>
57 #define DEFAULT_STOP_TIMEOUT 10
58 #define PHASH_SIZE 256
60 LIST_HEAD(phhead, phash);
70 extern char **environ;
72 static int run_command(struct cfjail *j);
73 static int add_proc(struct cfjail *j, pid_t pid);
74 static void clear_procs(struct cfjail *j);
75 static struct cfjail *find_proc(pid_t pid);
76 static int term_procs(struct cfjail *j);
77 static int get_user_info(struct cfjail *j, const char *username,
78 const struct passwd **pwdp, login_cap_t **lcapp);
79 static int check_path(struct cfjail *j, const char *pname, const char *path,
80 int isfile, const char *umount_type);
82 static struct cfjails sleeping = TAILQ_HEAD_INITIALIZER(sleeping);
83 static struct cfjails runnable = TAILQ_HEAD_INITIALIZER(runnable);
84 static struct cfstring dummystring = { .len = 1 };
85 static struct phhead phash[PHASH_SIZE];
91 static cpusetid_t setid = CPUSET_INVALID;
94 /* Only try to get the cpuset once. */
95 if (error == 0 && setid == CPUSET_INVALID)
96 error = cpuset_getid(CPU_LEVEL_ROOT, CPU_WHICH_PID, -1, &setid);
98 return (CPUSET_INVALID);
103 * Run the next command associated with a jail.
106 next_command(struct cfjail *j)
108 enum intparam comparam;
109 int create_failed, stopping;
111 if (paralimit == 0) {
112 if (j->flags & JF_FROM_RUNQ)
113 requeue_head(j, &runnable);
115 requeue(j, &runnable);
118 j->flags &= ~JF_FROM_RUNQ;
119 create_failed = (j->flags & (JF_STOP | JF_FAILED)) == JF_FAILED;
120 stopping = (j->flags & JF_STOP) != 0;
121 comparam = *j->comparam;
123 if (j->comstring == NULL) {
124 j->comparam += create_failed ? -1 : 1;
125 switch ((comparam = *j->comparam)) {
129 if (!bool_param(j->intparams[IP_MOUNT_DEVFS]))
131 j->comstring = &dummystring;
133 case IP_MOUNT_FDESCFS:
134 if (!bool_param(j->intparams[IP_MOUNT_FDESCFS]))
136 j->comstring = &dummystring;
138 case IP_MOUNT_PROCFS:
139 if (!bool_param(j->intparams[IP_MOUNT_PROCFS]))
141 j->comstring = &dummystring;
144 case IP_STOP_TIMEOUT:
145 j->comstring = &dummystring;
148 if (j->intparams[comparam] == NULL)
150 j->comstring = create_failed || (stopping &&
151 (j->intparams[comparam]->flags & PF_REV))
152 ? TAILQ_LAST(&j->intparams[comparam]->val,
154 : TAILQ_FIRST(&j->intparams[comparam]->val);
157 j->comstring = j->comstring == &dummystring ? NULL :
158 create_failed || (stopping &&
159 (j->intparams[comparam]->flags & PF_REV))
160 ? TAILQ_PREV(j->comstring, cfstrings, tq)
161 : TAILQ_NEXT(j->comstring, tq);
163 if (j->comstring == NULL || j->comstring->len == 0 ||
164 (create_failed && (comparam == IP_EXEC_PRESTART ||
165 comparam == IP_EXEC_CREATED || comparam == IP_EXEC_START ||
166 comparam == IP_COMMAND || comparam == IP_EXEC_POSTSTART ||
167 comparam == IP_EXEC_PREPARE)))
169 switch (run_command(j)) {
180 * Check command exit status
183 finish_command(struct cfjail *j)
188 if (!(j->flags & JF_SLEEPQ))
190 j->flags &= ~JF_SLEEPQ;
191 if (*j->comparam == IP_STOP_TIMEOUT) {
192 j->flags &= ~JF_TIMEOUT;
197 if (!TAILQ_EMPTY(&runnable)) {
198 rj = TAILQ_FIRST(&runnable);
199 rj->flags |= JF_FROM_RUNQ;
203 if (j->flags & JF_TIMEOUT) {
204 j->flags &= ~JF_TIMEOUT;
205 if (*j->comparam != IP_STOP_TIMEOUT) {
206 jail_warnx(j, "%s: timed out", j->comline);
209 } else if (verbose > 0)
210 jail_note(j, "timed out\n");
211 } else if (j->pstatus != 0) {
212 if (WIFSIGNALED(j->pstatus))
213 jail_warnx(j, "%s: exited on signal %d",
214 j->comline, WTERMSIG(j->pstatus));
216 jail_warnx(j, "%s: failed", j->comline);
227 * Check for finished processes or timeouts.
230 next_proc(int nonblock)
234 struct timespec *tsp;
237 if (!TAILQ_EMPTY(&sleeping)) {
240 if ((j = TAILQ_FIRST(&sleeping)) && j->timeout.tv_sec) {
241 clock_gettime(CLOCK_REALTIME, &ts);
242 ts.tv_sec = j->timeout.tv_sec - ts.tv_sec;
243 ts.tv_nsec = j->timeout.tv_nsec - ts.tv_nsec;
244 if (ts.tv_nsec < 0) {
246 ts.tv_nsec += 1000000000;
249 (ts.tv_sec == 0 && ts.tv_nsec == 0)) {
250 j->flags |= JF_TIMEOUT;
261 switch (kevent(kq, NULL, 0, &ke, 1, tsp)) {
268 j = TAILQ_FIRST(&sleeping);
269 j->flags |= JF_TIMEOUT;
275 (void)waitpid(ke.ident, NULL, WNOHANG);
276 if ((j = find_proc(ke.ident))) {
277 j->pstatus = ke.data;
287 * Run a single command for a jail, possibly inside the jail.
290 run_command(struct cfjail *j)
292 const struct passwd *pwd;
293 const struct cfstring *comstring, *s;
296 char *acs, *cs, *comcs, *devpath;
297 const char *jidstr, *conslog, *path, *ruleset, *term, *username;
298 enum intparam comparam;
302 int argc, bg, clean, consfd, down, fib, i, injail, sjuser, timeout;
303 #if defined(INET) || defined(INET6)
304 char *addr, *extrap, *p, *val;
307 static char *cleanenv;
309 /* Perform some operations that aren't actually commands */
310 comparam = *j->comparam;
311 down = j->flags & (JF_STOP | JF_FAILED);
313 case IP_STOP_TIMEOUT:
314 return term_procs(j);
318 if (jail_remove(j->jid) < 0 && errno == EPERM) {
319 jail_warnx(j, "jail_remove: %s",
323 if (verbose > 0 || (verbose == 0 && (j->flags & JF_STOP
324 ? note_remove : j->name != NULL)))
325 jail_note(j, "removed\n");
327 if (j->flags & JF_STOP)
328 dep_done(j, DF_LIGHT);
330 j->flags &= ~JF_PERSIST;
332 if (create_jail(j) < 0)
335 printf("%d\n", j->jid);
336 if (verbose >= 0 && (j->name || verbose > 0))
337 jail_note(j, "created\n");
338 dep_done(j, DF_LIGHT);
345 * Collect exec arguments. Internal commands for network and
346 * mounting build their own argument lists.
348 comstring = j->comstring;
354 val = alloca(strlen(comstring->s) + 1);
355 strcpy(val, comstring->s);
358 while ((p = strchr(cs, ' ')) != NULL && strlen(p) > 1) {
359 if (extrap == NULL) {
367 argv = alloca((8 + argc) * sizeof(char *));
368 argv[0] = _PATH_IFCONFIG;
369 if ((cs = strchr(val, '|'))) {
370 argv[1] = acs = alloca(cs - val + 1);
371 strlcpy(acs, val, cs - val + 1);
374 argv[1] = string_param(j->intparams[IP_INTERFACE]);
378 if (!(cs = strchr(addr, '/'))) {
381 argv[5] = "255.255.255.255";
383 } else if (strchr(cs + 1, '.')) {
384 argv[3] = acs = alloca(cs - addr + 1);
385 strlcpy(acs, addr, cs - addr + 1);
394 if (!down && extrap != NULL) {
395 for (cs = strtok(extrap, " "); cs;
396 cs = strtok(NULL, " ")) {
397 size_t len = strlen(cs) + 1;
398 argv[argc++] = acs = alloca(len);
399 strlcpy(acs, cs, len);
403 argv[argc] = down ? "-alias" : "alias";
404 argv[argc + 1] = NULL;
411 val = alloca(strlen(comstring->s) + 1);
412 strcpy(val, comstring->s);
415 while ((p = strchr(cs, ' ')) != NULL && strlen(p) > 1) {
416 if (extrap == NULL) {
424 argv = alloca((8 + argc) * sizeof(char *));
425 argv[0] = _PATH_IFCONFIG;
426 if ((cs = strchr(val, '|'))) {
427 argv[1] = acs = alloca(cs - val + 1);
428 strlcpy(acs, val, cs - val + 1);
431 argv[1] = string_param(j->intparams[IP_INTERFACE]);
436 if (!(cs = strchr(addr, '/'))) {
437 argv[4] = "prefixlen";
444 for (cs = strtok(extrap, " "); cs;
445 cs = strtok(NULL, " ")) {
446 size_t len = strlen(cs) + 1;
447 argv[argc++] = acs = alloca(len);
448 strlcpy(acs, cs, len);
452 argv[argc] = down ? "-alias" : "alias";
453 argv[argc + 1] = NULL;
457 case IP_VNET_INTERFACE:
458 argv = alloca(5 * sizeof(char *));
459 argv[0] = _PATH_IFCONFIG;
460 argv[1] = comstring->s;
461 argv[2] = down ? "-vnet" : "vnet";
462 jidstr = string_param(j->intparams[KP_JID]);
463 argv[3] = jidstr ? jidstr : string_param(j->intparams[KP_NAME]);
468 case IP__MOUNT_FROM_FSTAB:
469 argv = alloca(8 * sizeof(char *));
470 comcs = alloca(comstring->len + 1);
471 strcpy(comcs, comstring->s);
473 for (cs = strtok(comcs, " \t\f\v\r\n"); cs && argc < 4;
474 cs = strtok(NULL, " \t\f\v\r\n")) {
475 if (argc <= 1 && strunvis(cs, cs) < 0) {
476 jail_warnx(j, "%s: %s: fstab parse error",
477 j->intparams[comparam]->name, comstring->s);
485 jail_warnx(j, "%s: %s: missing information",
486 j->intparams[comparam]->name, comstring->s);
489 if (check_path(j, j->intparams[comparam]->name, argv[1], 0,
490 down ? argv[2] : NULL) < 0)
495 argv[0] = "/sbin/umount";
508 argv[0] = _PATH_MOUNT;
514 argv = alloca(7 * sizeof(char *));
515 path = string_param(j->intparams[KP_PATH]);
517 jail_warnx(j, "mount.devfs: no jail root path defined");
520 devpath = alloca(strlen(path) + 5);
521 sprintf(devpath, "%s/dev", path);
522 if (check_path(j, "mount.devfs", devpath, 0,
523 down ? "devfs" : NULL) < 0)
526 argv[0] = "/sbin/umount";
530 argv[0] = _PATH_MOUNT;
533 ruleset = string_param(j->intparams[KP_DEVFS_RULESET]);
535 ruleset = "4"; /* devfsrules_jail */
536 argv[3] = acs = alloca(11 + strlen(ruleset));
537 sprintf(acs, "-oruleset=%s", ruleset);
544 case IP_MOUNT_FDESCFS:
545 argv = alloca(7 * sizeof(char *));
546 path = string_param(j->intparams[KP_PATH]);
548 jail_warnx(j, "mount.fdescfs: no jail root path defined");
551 devpath = alloca(strlen(path) + 8);
552 sprintf(devpath, "%s/dev/fd", path);
553 if (check_path(j, "mount.fdescfs", devpath, 0,
554 down ? "fdescfs" : NULL) < 0)
557 argv[0] = "/sbin/umount";
561 argv[0] = _PATH_MOUNT;
570 case IP_MOUNT_PROCFS:
571 argv = alloca(7 * sizeof(char *));
572 path = string_param(j->intparams[KP_PATH]);
574 jail_warnx(j, "mount.procfs: no jail root path defined");
577 devpath = alloca(strlen(path) + 6);
578 sprintf(devpath, "%s/proc", path);
579 if (check_path(j, "mount.procfs", devpath, 0,
580 down ? "procfs" : NULL) < 0)
583 argv[0] = "/sbin/umount";
587 argv[0] = _PATH_MOUNT;
598 goto default_command;
600 TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq)
602 argv = alloca((argc + 1) * sizeof(char *));
604 TAILQ_FOREACH(s, &j->intparams[IP_COMMAND]->val, tq)
607 j->comstring = &dummystring;
612 if ((cs = strpbrk(comstring->s, "!\"$&'()*;<>?[\\]`{|}~")) &&
613 !(cs[0] == '&' && cs[1] == '\0')) {
614 argv = alloca(4 * sizeof(char *));
615 argv[0] = _PATH_BSHELL;
617 argv[2] = comstring->s;
624 comcs = alloca(comstring->len + 1);
625 strcpy(comcs, comstring->s);
627 for (cs = strtok(comcs, " \t\f\v\r\n"); cs;
628 cs = strtok(NULL, " \t\f\v\r\n"))
630 argv = alloca((argc + 1) * sizeof(char *));
631 strcpy(comcs, comstring->s);
633 for (cs = strtok(comcs, " \t\f\v\r\n"); cs;
634 cs = strtok(NULL, " \t\f\v\r\n"))
642 if (int_param(j->intparams[IP_EXEC_TIMEOUT], &timeout) &&
644 clock_gettime(CLOCK_REALTIME, &j->timeout);
645 j->timeout.tv_sec += timeout;
647 j->timeout.tv_sec = 0;
649 injail = comparam == IP_EXEC_START || comparam == IP_COMMAND ||
650 comparam == IP_EXEC_STOP;
652 setid = root_cpuset_id();
654 setid = CPUSET_INVALID;
655 clean = bool_param(j->intparams[IP_EXEC_CLEAN]);
656 username = string_param(j->intparams[injail
657 ? IP_EXEC_JAIL_USER : IP_EXEC_SYSTEM_USER]);
658 sjuser = bool_param(j->intparams[IP_EXEC_SYSTEM_JAIL_USER]);
662 (conslog = string_param(j->intparams[IP_EXEC_CONSOLELOG]))) {
663 if (check_path(j, "exec.consolelog", conslog, 1, NULL) < 0)
666 open(conslog, O_WRONLY | O_CREAT | O_APPEND, DEFFILEMODE);
668 jail_warnx(j, "open %s: %s", conslog, strerror(errno));
674 for (i = 0; argv[i]; i++)
675 comlen += strlen(argv[i]) + 1;
676 j->comline = cs = emalloc(comlen);
677 for (i = 0; argv[i]; i++) {
680 cs += strlen(argv[i]) + 1;
685 jail_note(j, "run command%s%s%s: %s\n",
686 injail ? " in jail" : "", username ? " as " : "",
687 username ? username : "", j->comline);
693 if (bg || !add_proc(j, pid)) {
705 /* Set up the environment and run the command */
708 if ((clean || username) && injail && sjuser &&
709 get_user_info(j, username, &pwd, &lcap) < 0)
712 /* jail_attach won't chdir along with its chroot. */
713 path = string_param(j->intparams[KP_PATH]);
714 if (path && chdir(path) < 0) {
715 jail_warnx(j, "chdir %s: %s", path, strerror(errno));
718 if (int_param(j->intparams[IP_EXEC_FIB], &fib) &&
720 jail_warnx(j, "setfib: %s", strerror(errno));
725 * We wouldn't have specialized our affinity, so just setid to
726 * root. We do this prior to attaching to avoid the kernel
727 * having to create a transient cpuset that we'll promptly
728 * free up with a reset to the jail's cpuset.
730 * This is just a best-effort to use as wide of mask as
733 if (setid != CPUSET_INVALID)
734 (void)cpuset_setid(CPU_WHICH_PID, -1, setid);
736 if (jail_attach(j->jid) < 0) {
737 jail_warnx(j, "jail_attach: %s", strerror(errno));
741 if (clean || username) {
742 if (!(injail && sjuser) &&
743 get_user_info(j, username, &pwd, &lcap) < 0)
746 term = getenv("TERM");
748 setenv("PATH", "/bin:/usr/bin", 0);
750 setenv("TERM", term, 1);
752 if (setgid(pwd->pw_gid) < 0) {
753 jail_warnx(j, "setgid %d: %s", pwd->pw_gid,
757 if (setusercontext(lcap, pwd, pwd->pw_uid, username
758 ? LOGIN_SETALL & ~LOGIN_SETGROUP & ~LOGIN_SETLOGIN
759 : LOGIN_SETPATH | LOGIN_SETENV) < 0) {
760 jail_warnx(j, "setusercontext %s: %s", pwd->pw_name,
765 setenv("USER", pwd->pw_name, 1);
766 setenv("HOME", pwd->pw_dir, 1);
768 *pwd->pw_shell ? pwd->pw_shell : _PATH_BSHELL, 1);
769 if (clean && chdir(pwd->pw_dir) < 0) {
770 jail_warnx(j, "chdir %s: %s",
771 pwd->pw_dir, strerror(errno));
777 if (consfd != 0 && (dup2(consfd, 1) < 0 || dup2(consfd, 2) < 0)) {
778 jail_warnx(j, "exec.consolelog: %s", strerror(errno));
782 execvp(argv[0], __DECONST(char *const*, argv));
783 jail_warnx(j, "exec %s: %s", argv[0], strerror(errno));
788 * Add a process to the hash, tied to a jail.
791 add_proc(struct cfjail *j, pid_t pid)
797 if (!kq && (kq = kqueue()) < 0)
799 EV_SET(&ke, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
800 if (kevent(kq, &ke, 1, NULL, 0, NULL) < 0) {
805 ph = emalloc(sizeof(struct phash));
808 LIST_INSERT_HEAD(&phash[pid % PHASH_SIZE], ph, le);
810 j->flags |= JF_SLEEPQ;
811 if (j->timeout.tv_sec == 0)
812 requeue(j, &sleeping);
814 /* File the jail in the sleep queue according to its timeout. */
815 TAILQ_REMOVE(j->queue, j, tq);
816 TAILQ_FOREACH(tj, &sleeping, tq) {
817 if (!tj->timeout.tv_sec ||
818 j->timeout.tv_sec < tj->timeout.tv_sec ||
819 (j->timeout.tv_sec == tj->timeout.tv_sec &&
820 j->timeout.tv_nsec <= tj->timeout.tv_nsec)) {
821 TAILQ_INSERT_BEFORE(tj, j, tq);
826 TAILQ_INSERT_TAIL(&sleeping, j, tq);
827 j->queue = &sleeping;
833 * Remove any processes from the hash that correspond to a jail.
836 clear_procs(struct cfjail *j)
839 struct phash *ph, *tph;
843 for (i = 0; i < PHASH_SIZE; i++)
844 LIST_FOREACH_SAFE(ph, &phash[i], le, tph)
846 EV_SET(&ke, ph->pid, EVFILT_PROC, EV_DELETE,
848 (void)kevent(kq, &ke, 1, NULL, 0, NULL);
855 * Find the jail that corresponds to an exited process.
857 static struct cfjail *
863 LIST_FOREACH(ph, &phash[pid % PHASH_SIZE], le)
864 if (ph->pid == pid) {
868 return --j->nprocs ? NULL : j;
874 * Send SIGTERM to all processes in a jail and wait for them to die.
877 term_procs(struct cfjail *j)
879 struct kinfo_proc *ki;
880 int i, noted, pcnt, timeout;
884 if (!int_param(j->intparams[IP_STOP_TIMEOUT], &timeout))
885 timeout = DEFAULT_STOP_TIMEOUT;
886 else if (timeout == 0)
890 kd = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL);
895 ki = kvm_getprocs(kd, KERN_PROC_PROC, 0, &pcnt);
899 for (i = 0; i < pcnt; i++)
900 if (ki[i].ki_jid == j->jid &&
901 kill(ki[i].ki_pid, SIGTERM) == 0) {
902 (void)add_proc(j, ki[i].ki_pid);
906 jail_note(j, "sent SIGTERM to:");
908 printf(" %d", ki[i].ki_pid);
914 clock_gettime(CLOCK_REALTIME, &j->timeout);
915 j->timeout.tv_sec += timeout;
922 * Look up a user in the passwd and login.conf files.
925 get_user_info(struct cfjail *j, const char *username,
926 const struct passwd **pwdp, login_cap_t **lcapp)
928 const struct passwd *pwd;
931 *pwdp = pwd = username ? getpwnam(username) : getpwuid(getuid());
934 jail_warnx(j, "getpwnam%s%s: %s", username ? " " : "",
935 username ? username : "", strerror(errno));
937 jail_warnx(j, "%s: no such user", username);
939 jail_warnx(j, "unknown uid %d", getuid());
942 *lcapp = login_getpwclass(pwd);
943 if (*lcapp == NULL) {
944 jail_warnx(j, "getpwclass %s: %s", pwd->pw_name,
948 /* Set the groups while the group file is still available */
949 if (initgroups(pwd->pw_name, pwd->pw_gid) < 0) {
950 jail_warnx(j, "initgroups %s: %s", pwd->pw_name,
958 * Make sure a mount or consolelog path is a valid absolute pathname
962 check_path(struct cfjail *j, const char *pname, const char *path, int isfile,
963 const char *umount_type)
965 struct stat st, mpst;
968 const char *jailpath;
971 if (path[0] != '/') {
972 jail_warnx(j, "%s: %s: not an absolute pathname",
977 * Only check for symlinks in components below the jail's path,
978 * since that's where the security risk lies.
980 jailpath = string_param(j->intparams[KP_PATH]);
981 if (jailpath == NULL)
983 jplen = strlen(jailpath);
984 if (!strncmp(path, jailpath, jplen) && path[jplen] == '/') {
985 tpath = alloca(strlen(path) + 1);
987 for (p = tpath + jplen; p != NULL; ) {
988 p = strchr(p + 1, '/');
991 if (lstat(tpath, &st) < 0) {
992 if (errno == ENOENT && isfile && !p)
994 jail_warnx(j, "%s: %s: %s", pname, tpath,
998 if (S_ISLNK(st.st_mode)) {
999 jail_warnx(j, "%s: %s is a symbolic link",
1007 if (umount_type != NULL) {
1008 if (stat(path, &st) < 0 || statfs(path, &stfs) < 0) {
1009 jail_warnx(j, "%s: %s: %s", pname, path,
1013 if (stat(stfs.f_mntonname, &mpst) < 0) {
1014 jail_warnx(j, "%s: %s: %s", pname, stfs.f_mntonname,
1018 if (st.st_ino != mpst.st_ino) {
1019 jail_warnx(j, "%s: %s: not a mount point",
1023 if (strcmp(stfs.f_fstypename, umount_type)) {
1024 jail_warnx(j, "%s: %s: not a %s mount",
1025 pname, path, umount_type);