From 74d835463e05e5761f6f5271e487f299f29d3f07 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Fri, 27 Mar 2015 02:27:16 +0100 Subject: make it optional to remount the tmpfs as ro Signed-off-by: John Crispin --- jail/jail.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jail/jail.c b/jail/jail.c index 08d5ee1..3b5587a 100644 --- a/jail/jail.c +++ b/jail/jail.c @@ -43,7 +43,7 @@ #include #define STACK_SIZE (1024 * 1024) -#define OPT_ARGS "P:S:n:r:w:psuld" +#define OPT_ARGS "P:S:n:r:w:psuldo" struct extra { struct list_head list; @@ -289,6 +289,7 @@ static int spawn_child(void *arg) char **argv = arg; int argc = 0, ch; char *mpoint; + int ronly = 0; while (argv[argc]) argc++; @@ -305,6 +306,9 @@ static int spawn_child(void *arg) case 'p': procfs = 1; break; + case 'o': + ronly = 1; + break; case 's': sysfs = 1; break; @@ -331,7 +335,8 @@ static int spawn_child(void *arg) mkdir("/sys", 0755); mount("sysfs", "/sys", "sysfs", MS_NOATIME, 0); } - mount(NULL, "/", NULL, MS_RDONLY | MS_REMOUNT, 0); + if (ronly) + mount(NULL, "/", NULL, MS_RDONLY | MS_REMOUNT, 0); uloop_init(); -- cgit v1.2.3