Skip to content

Commit 3e859a5

Browse files
committed
fix: change the propagation type of the root mount to shared
The mount propagation type will be private,slave if a new mount namespace is creted by clone() and CLONE_NEWUSER is also used. Change it to shared,slave. Signed-off-by: reddevillg <reddevillg@gmail.com>
1 parent 8bca65a commit 3e859a5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

libs/utils/src/linglong/utils/namespace.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "linglong/utils/log/log.h"
1111

1212
#include <sys/capability.h>
13+
#include <sys/mount.h>
1314
#include <sys/prctl.h>
1415

1516
#include <fstream>
@@ -312,6 +313,8 @@ int runInNamespaceEntry(void *args)
312313
}
313314
}
314315

316+
mount("", "/", "", MS_SHARED | MS_REC, NULL);
317+
315318
LogD("run command {}", runInNamespaceArgs->argv[0]);
316319
for (int i = 1; i < runInNamespaceArgs->argc; ++i) {
317320
LogD("argv[{}]: {}", i, runInNamespaceArgs->argv[i]);

0 commit comments

Comments
 (0)