Skip to content

Commit 8a14673

Browse files
valpackettjakecorrenti
authored andcommitted
init: set MS_SHARED for the root mount
systemd expects container runtimes to do this[1], otherwise various things (such as credential passing) break. It's generally the reasonable default and other container software might expect it to already be set as well. [1]: https://systemd.io/CONTAINER_INTERFACE/ Signed-off-by: Val Packett <val@invisiblethingslab.com>
1 parent 1abe621 commit 8a14673

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

init/init.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,11 @@ int main(int argc, char **argv)
11331133
}
11341134
}
11351135

1136+
if (mount(NULL, "/", NULL, MS_REC | MS_SHARED, NULL) < 0) {
1137+
perror("Couldn't set shared propagation on the root mount");
1138+
exit(-1);
1139+
}
1140+
11361141
setsid();
11371142
ioctl(0, TIOCSCTTY, 1);
11381143

0 commit comments

Comments
 (0)