Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Apr 2021 19:19:29 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 110ebf088682 - stable/12 - mount: Disallow mounting over a jail root
Message-ID:  <202104061919.136JJTWM097614@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=110ebf0886825227d03d2ab17139a8741272aef5

commit 110ebf0886825227d03d2ab17139a8741272aef5
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-04-06 18:57:57 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-04-06 18:57:57 +0000

    mount: Disallow mounting over a jail root
    
    Discussed with: jamie
    Approved by:    so
    Security:       CVE-2020-25584
    Security:       FreeBSD-SA-21:10.jail_mount
---
 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 9befa5361c16..4addc14f7541 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -844,10 +844,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);
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104061919.136JJTWM097614>