From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:19:15 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5F7265B51F2; Tue, 6 Apr 2021 19:19:15 +0000 (UTC) (envelope-from git@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) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFHQC2JSrz4cnj; Tue, 6 Apr 2021 19:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4292811B98; Tue, 6 Apr 2021 19:19:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 136JJFXe097428; Tue, 6 Apr 2021 19:19:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JJFXW097427; Tue, 6 Apr 2021 19:19:15 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:15 GMT Message-Id: <202104061919.136JJFXW097427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 4710439ec594 - releng/13.0 - mount: Disallow mounting over a jail root MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 4710439ec594a5375657acc403326f868d05a05a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:19:15 -0000 The branch releng/13.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4710439ec594a5375657acc403326f868d05a05a commit 4710439ec594a5375657acc403326f868d05a05a Author: Mark Johnston AuthorDate: 2021-04-05 21:19:15 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:18:59 +0000 mount: Disallow mounting over a jail root Discussed with: jamie Approved by: re (so, implicit) Approved by: so Security: CVE-2020-25584 Security: FreeBSD-SA-21:10.jail_mount (cherry picked from commit 2425f5e9128102c8e6e473567ad6759a55be5b02) (cherry picked from commit 3ae17faa370491d7ce1fcfc4d5b9cd1ed0117b67) --- sys/kern/vfs_mount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index b3870e46c5e9..59000728efcc 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -918,10 +918,10 @@ vfs_domount_first( /* * If the jail of the calling thread lacks permission for this type of - * file system, deny immediately. + * file system, or is trying to cover its own root, deny immediately. */ - if (jailed(td->td_ucred) && !prison_allow(td->td_ucred, - vfsp->vfc_prison_flag)) { + if (jailed(td->td_ucred) && (!prison_allow(td->td_ucred, + vfsp->vfc_prison_flag) || vp == td->td_ucred->cr_prison->pr_root)) { vput(vp); return (EPERM); }