Skip to content

Commit dabef1c

Browse files
committed
Do not change bind mount attributes on top-level directories
1 parent 4045b9a commit dabef1c

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/nvc_mount.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,9 @@ mount_files(struct error *err, const struct nvc_container *cnt, const char *dir,
4545

4646
ptr = path + strlen(path);
4747

48-
/* Bind mount the top directory with slave propagation. */
49-
if (xmount(err, path, path, NULL, MS_BIND|MS_REC, NULL) < 0)
48+
/* Bind mount the top directory and every files under it with read-only permissions. */
49+
if (xmount(err, path, path, NULL, MS_BIND, NULL) < 0)
5050
goto fail;
51-
if (xmount(err, NULL, path, NULL, MS_BIND|MS_REC|MS_REMOUNT | MS_NODEV|MS_NOSUID, NULL) < 0)
52-
goto fail;
53-
if (xmount(err, NULL, path, NULL, MS_SLAVE|MS_REC, NULL) < 0)
54-
goto fail;
55-
56-
/* Bind mount every files under the top directory with read-only permissions. */
5751
for (size_t i = 0; i < size; ++i) {
5852
if (path_append(err, path, basename(paths[i])) < 0)
5953
goto fail;

0 commit comments

Comments
 (0)