]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFS jail: Change both root and working directories in jail_attach(2)
authorJamie Gritton <jamie@FreeBSD.org>
Fri, 19 Feb 2021 22:13:35 +0000 (14:13 -0800)
committerJamie Gritton <jamie@FreeBSD.org>
Mon, 22 Feb 2021 18:25:23 +0000 (10:25 -0800)
commitf3f042d850baaeda1bed19e00c2b3b578644b7e9
treef801690023b0b289d29be1d62c0fe6aac2774fe8
parent5d07525b81af284c2be4ae438bcf000785122cf2
MFS jail: Change both root and working directories in jail_attach(2)

jail_attach(2) performs an internal chroot operation, leaving it up to
the calling process to assure the working directory is inside the jail.

Add a matching internal chdir operation to the jail's root.  Also
ignore kern.chroot_allow_open_directories, and always disallow the
operation if there are any directory descriptors open.

Reported by:    mjg
Approved by:    re (gjb), markj, kib

(cherry picked from commit d4380c0cdd0517dc038403dd5c99242ce78bdeb5)
(cherry picked from commit 5dbb407145c8128753fa30b695bc266dc671e433)
lib/libc/sys/jail.2
sys/kern/kern_descrip.c
sys/kern/kern_jail.c
sys/sys/filedesc.h