kern/58497: sysctl knob to return current process' jid
C. Stephen Gunn
csg at waterspout.com
Fri Oct 24 13:40:14 PDT 2003
>Synopsis: sysctl knob to return current process' jid
>Arrival-Date: Fri Oct 24 13:40:12 PDT 2003
>Originator: C. Stephen Gunn
>Release: FreeBSD 5.1-CURRENT i386
WaterSpout Communications, Inc.
FreeBSD dual450.waterspout.com 5.1-CURRENT FreeBSD 5.1-CURRENT #1: Sun Oct 19 21:57:46 CDT 2003 root at dual450.waterspout.com:/usr/src/sys/i386/compile/DUAL450 i386
There is no easy way to tell if a process is operating in a Jail
environment. This lever would be useful in /etc/rc to avoid
invocations of privledged commands (sysctl, mount, fsck, etc)
that are known to be prohibited in the jail.
I have other work against the /etc/rc subsystem that uses this
mechanism to avoid carping about operations that are not permitted.
Start a jail and execute /etc/rc, watch all the errors and warnings,
fiddle with 'ps | grep ..J..' for a while trying to figure out
if you are currently in a jail.
The following patch (against current), adds a sysctl knob that returns
the jid of the calling process, or 0 when the process is not jailed.
MD5 (security_jail_jid.diff) = b4b6e0fa944271977c94688e76e9f372
More information about the freebsd-bugs