From owner-svn-src-head@freebsd.org Sat Feb 8 15:51:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4DB2A244C3D; Sat, 8 Feb 2020 15:51:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48FGqK1RLTz3xV6; Sat, 8 Feb 2020 15:51:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C9271FB4F; Sat, 8 Feb 2020 15:51:09 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 018Fp9Gw054311; Sat, 8 Feb 2020 15:51:09 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 018Fp8vI054303; Sat, 8 Feb 2020 15:51:08 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202002081551.018Fp8vI054303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 8 Feb 2020 15:51:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r357679 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 357679 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Feb 2020 15:51:09 -0000 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);