svn commit: r357679 - head/sys/kern
Mateusz Guzik
mjg at FreeBSD.org
Sat Feb 8 15:51:09 UTC 2020
Author: mjg
Date: Sat Feb 8 15:51:08 2020
New Revision: 357679
URL: https://svnweb.freebsd.org/changeset/base/357679
Log:
vfs: remove now useless ENODEV handling from vn_fullpath consumers
Noted by: ngie
Modified:
head/sys/kern/kern_jail.c
head/sys/kern/vfs_mount.c
Modified: head/sys/kern/kern_jail.c
==============================================================================
--- head/sys/kern/kern_jail.c Sat Feb 8 15:06:06 2020 (r357678)
+++ head/sys/kern/kern_jail.c Sat Feb 8 15:51:08 2020 (r357679)
@@ -490,7 +490,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
int gotchildmax, gotenforce, gothid, gotrsnum, gotslevel;
int jid, jsys, len, level;
int childmax, osreldt, rsnum, slevel;
- int fullpath_disabled;
#if defined(INET) || defined(INET6)
int ii, ij;
#endif
@@ -894,7 +893,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
}
}
- fullpath_disabled = 0;
root = NULL;
error = vfs_getopt(opts, "path", (void **)&path, &len);
if (error == ENOENT)
@@ -922,13 +920,8 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
g_path = malloc(MAXPATHLEN, M_TEMP, M_WAITOK);
strlcpy(g_path, path, MAXPATHLEN);
error = vn_path_to_global_path(td, root, g_path, MAXPATHLEN);
- if (error == 0)
+ if (error == 0) {
path = g_path;
- else if (error == ENODEV) {
- /* proceed if sysctl debug.disablefullpath == 1 */
- fullpath_disabled = 1;
- if (len < 2 || (len == 2 && path[0] == '/'))
- path = NULL;
} else {
/* exit on other errors */
goto done_free;
@@ -939,15 +932,6 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
goto done_free;
}
VOP_UNLOCK(root);
- if (fullpath_disabled) {
- /* Leave room for a real-root full pathname. */
- if (len + (path[0] == '/' && strcmp(mypr->pr_path, "/")
- ? strlen(mypr->pr_path) : 0) > MAXPATHLEN) {
- error = ENAMETOOLONG;
- vrele(root);
- goto done_free;
- }
- }
}
/*
@@ -1652,12 +1636,7 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
}
if (path != NULL) {
/* Try to keep a real-rooted full pathname. */
- if (fullpath_disabled && path[0] == '/' &&
- strcmp(mypr->pr_path, "/"))
- snprintf(pr->pr_path, sizeof(pr->pr_path), "%s%s",
- mypr->pr_path, path);
- else
- strlcpy(pr->pr_path, path, sizeof(pr->pr_path));
+ strlcpy(pr->pr_path, path, sizeof(pr->pr_path));
pr->pr_root = root;
}
if (PR_HOST & ch_flags & ~pr_flags) {
Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c Sat Feb 8 15:06:06 2020 (r357678)
+++ head/sys/kern/vfs_mount.c Sat Feb 8 15:51:08 2020 (r357679)
@@ -1266,8 +1266,7 @@ vfs_domount(
pathbuf = malloc(MNAMELEN, M_TEMP, M_WAITOK);
strcpy(pathbuf, fspath);
error = vn_path_to_global_path(td, vp, pathbuf, MNAMELEN);
- /* debug.disablefullpath == 1 results in ENODEV */
- if (error == 0 || error == ENODEV) {
+ if (error == 0) {
error = vfs_domount_first(td, vfsp, pathbuf, vp,
fsflags, optlist);
}
@@ -1346,7 +1345,7 @@ kern_unmount(struct thread *td, const char *path, int
NDFREE(&nd, NDF_ONLY_PNBUF);
error = vn_path_to_global_path(td, nd.ni_vp, pathbuf,
MNAMELEN);
- if (error == 0 || error == ENODEV)
+ if (error == 0)
vput(nd.ni_vp);
}
mtx_lock(&mountlist_mtx);
More information about the svn-src-all
mailing list