summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-02-19 14:29:14 +0000
committerpjd <pjd@FreeBSD.org>2004-02-19 14:29:14 +0000
commit01946bf901b7d021b929e564a27a59ce7e719b94 (patch)
tree57ae49b51c623f2d0beb1b283d09a02a178c897d /sys/kern
parent6bf691177644769542e2d645d4f91392a0493f2a (diff)
downloadFreeBSD-src-01946bf901b7d021b929e564a27a59ce7e719b94.zip
FreeBSD-src-01946bf901b7d021b929e564a27a59ce7e719b94.tar.gz
Added sysctl security.jail.jailed.
It returns 1 is process is inside of jail and 0 if it is not. Information if we are in jail or not is not a secret, there is plenty of ways to discover it. Many people are using own hack to check this and this will be a legal way from now on. It will be great if our starting scripts will take advantage of this sysctl to allow clean "boot" inside jail. Approved by: rwatson, scottl (mentor)
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_jail.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index b867935..5893a3e 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -490,3 +490,16 @@ retry:
SYSCTL_OID(_security_jail, OID_AUTO, list, CTLTYPE_STRUCT | CTLFLAG_RD,
NULL, 0, sysctl_jail_list, "S", "List of active jails");
+
+static int
+sysctl_jail_jailed(SYSCTL_HANDLER_ARGS)
+{
+ int error, injail;
+
+ injail = jailed(req->td->td_ucred);
+ error = SYSCTL_OUT(req, &injail, sizeof(injail));
+
+ return (error);
+}
+SYSCTL_PROC(_security_jail, OID_AUTO, jailed, CTLTYPE_INT | CTLFLAG_RD,
+ NULL, 0, sysctl_jail_jailed, "I", "Process in jail?");
OpenPOWER on IntegriCloud