ujail: add basic /dev files
authorEtienne CHAMPETIER <champetier.etienne@gmail.com>
Fri, 30 Dec 2016 02:08:58 +0000 (18:08 -0800)
committerJohn Crispin <john@phrozen.org>
Tue, 10 Jan 2017 08:23:35 +0000 (09:23 +0100)
This adds
/dev/full
/dev/null
/dev/urandom
/dev/zero
in every jail (not having them only allow subtle bugs)

Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
jail/jail.c

index 834d67771d4606427254afd88068b3cc9ed78583..8e7cddc997448410ce05fcddde0fe7472596016e 100644 (file)
@@ -398,6 +398,11 @@ int main(int argc, char **argv)
 
        uloop_init();
        if (opts.namespace) {
+               add_mount("/dev/full", 0, -1);
+               add_mount("/dev/null", 0, -1);
+               add_mount("/dev/urandom", 0, -1);
+               add_mount("/dev/zero", 0, -1);
+
                int flags = CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | SIGCHLD;
                if (opts.hostname)
                        flags |= CLONE_NEWUTS;