minijail0: unbreak chroot and marshalling
1) Parse opts for chroot and bind
2) Serialize/deserialize chroot properly
BUG=chromium-os:21665
TEST=security_Minijail0
Change-Id: Ic99a40718a9c3ff72561f518179155fb502eef96
Signed-off-by: Elly Jones <ellyjones@chromium.org>
Reviewed-on: http://gerrit.chromium.org/gerrit/10507
Reviewed-by: Will Drewry <wad@chromium.org>
diff --git a/libminijail.c b/libminijail.c
index 8aa02bf..0a7df34 100644
--- a/libminijail.c
+++ b/libminijail.c
@@ -473,6 +473,13 @@
j->user = strdup(user);
}
+ if (j->chrootdir) { /* stale pointer */
+ char *chrootdir = consumestr(&serialized, &length);
+ if (!chrootdir)
+ return -EINVAL;
+ j->chrootdir = strdup(chrootdir);
+ }
+
if (j->flags.seccomp_filter && j->filter_count) {
count = j->filter_count;
/* Let add_seccomp_filter recompute the value. */