aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_fork.c
diff options
context:
space:
mode:
authorJamie Gritton <jamie@FreeBSD.org>2009-05-27 14:11:23 +0000
committerJamie Gritton <jamie@FreeBSD.org>2009-05-27 14:11:23 +0000
commit0304c7316344d7e2d1dee3aa0249724ec629e8ef (patch)
treeb7f782d79e61a1bd80655a068684cb0fd9f39922 /sys/kern/kern_fork.c
parentd76e4550e9fb13853fb9f80dc93e423949983d2c (diff)
downloadsrc-0304c7316344d7e2d1dee3aa0249724ec629e8ef.tar.gz
src-0304c7316344d7e2d1dee3aa0249724ec629e8ef.zip
Add hierarchical jails. A jail may further virtualize its environment
by creating a child jail, which is visible to that jail and to any parent jails. Child jails may be restricted more than their parents, but never less. Jail names reflect this hierarchy, being MIB-style dot-separated strings. Every thread now points to a jail, the default being prison0, which contains information about the physical system. Prison0's root directory is the same as rootvnode; its hostname is the same as the global hostname, and its securelevel replaces the global securelevel. Note that the variable "securelevel" has actually gone away, which should not cause any problems for code that properly uses securelevel_gt() and securelevel_ge(). Some jail-related permissions that were kept in global variables and set via sysctls are now per-jail settings. The sysctls still exist for backward compatibility, used only by the now-deprecated jail(2) system call. Approved by: bz (mentor)
Notes
Notes: svn path=/head/; revision=192895
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r--sys/kern/kern_fork.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 4e8dbb19ee2f..0c16c3ffa7f5 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysproto.h>
#include <sys/eventhandler.h>
#include <sys/filedesc.h>
+#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
#include <sys/sysctl.h>
@@ -54,7 +55,6 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/priv.h>
#include <sys/proc.h>
-#include <sys/jail.h>
#include <sys/pioctl.h>
#include <sys/resourcevar.h>
#include <sys/sched.h>
@@ -458,9 +458,8 @@ again:
p2->p_ucred = crhold(td->td_ucred);
- /* In case we are jailed tell the prison that we exist. */
- if (jailed(p2->p_ucred))
- prison_proc_hold(p2->p_ucred->cr_prison);
+ /* Tell the prison that we exist. */
+ prison_proc_hold(p2->p_ucred->cr_prison);
PROC_UNLOCK(p2);