diff options
author | Mark Johnston <markj@FreeBSD.org> | 2021-04-05 21:19:15 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2021-04-06 18:50:48 +0000 |
commit | 3ae17faa370491d7ce1fcfc4d5b9cd1ed0117b67 (patch) | |
tree | 829bb025a01b590631b4c02e181e3946b9d94541 | |
parent | 2e08308d62f381312b3da9dac8970dcdad4b3f2d (diff) |
mount: Disallow mounting over a jail root
Discussed with: jamie
Approved by: so
Security: CVE-2020-25584
Security: FreeBSD-SA-21:10.jail_mount
(cherry picked from commit 2425f5e9128102c8e6e473567ad6759a55be5b02)
-rw-r--r-- | sys/kern/vfs_mount.c | 6 |
1 files 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); } |