kern/103447: "mount -o nodev" was useful for preventing escape from chroot/jail etc.

Jukka A. Ukkonen jau at
Wed Sep 20 22:10:22 PDT 2006

>Number:         103447
>Category:       kern
>Synopsis:       "mount -o nodev" was useful for preventing escape from chroot/jail etc.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep 21 05:10:20 GMT 2006
>Originator:     Jukka A. Ukkonen
>Release:        6.2-PRERELEASE
private person
FreeBSD mjolnir 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #2: Wed Sep 20 08:33:47 EEST 2006     root at mjolnir:/usr/obj/usr/src/sys/Mjolnir  i386

It seems the mount option nodev no longer exists.
It had its merits in making it harder to escape from chroot/jail.
One known method for such escapes has been making a new device entry
matching the major and minor device numbers of the actual /, mounting
it inside the confinded file system, and chroot()ing to it.

Now that devfs is the only place where device entries should live
having nodev around would make all the more sense.
All the other mount points could be marked nodev in the fstab.

An easy way to test the "nodev" option is gone is to simply try using it with
a suitable test mount point.
"mount -o nodev" and the option "nodev" in fstab no longer are shown in
the output of "mount -p".
Also <sys/mount.h> defines it as...
#define MNT_NODEV       0               /* Deprecated option */

The normal file systems still can contain device nodes as before...
mknod rootdev c 0 142
The mknod creates a copy of a geom mirror used as the actual system root
in the system this was tried on.

Though jail can confine areas better than plain chroot also the latter
one will be around for quite some time. Having "mount -o nodev" around
would be one more addition to the layered onion like security.

If the nodev option was not awfully hard to maintain, please, return it to
the system.


More information about the freebsd-bugs mailing list