mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
test: don't do MS_REC|MS_PRIVATE for host mounts
Here is a race when someone umounted something and this operation
isn't propagated into our namespace.
CRIU | Another process
-----------------------------------------------------------------
pivot_root(".", put_root) |
mount(put_root, MS_REC|MS_PRIVATE) |
| umount /xxx/yyy
| umount /xxx -> EBUSY
umount(put_root)
We do this to not affect mounts in put_root, but we can mask
these mounts as slave and this will work for us and for external
users.
Reported-by: Mr Travis
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
c220c2f970
commit
42058dc7ce
3 changed files with 4 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
mount --make-rprivate /
|
||||
mount --make-rslave /
|
||||
umount -l /proc
|
||||
mount -t proc proc /proc/
|
||||
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc/
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ static int prepare_mntns(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (mount("./old", "./old", NULL, MS_PRIVATE | MS_REC , NULL)) {
|
||||
if (mount("./old", "./old", NULL, MS_SLAVE | MS_REC , NULL)) {
|
||||
fprintf(stderr, "Can't bind-mount root: %m\n");
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ int main(int argc, char **argv)
|
|||
return 1;
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) {
|
||||
fprintf(stderr, "mount(/, S_REC | MS_PRIVATE)): %m");
|
||||
if (mount(NULL, "/", NULL, MS_REC | MS_SLAVE, NULL)) {
|
||||
fprintf(stderr, "mount(/, S_REC | MS_SLAVE)): %m");
|
||||
return 1;
|
||||
}
|
||||
umount2("/proc", MNT_DETACH);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue