add comment about mounting sys with rbind in unshare mode

This commit is contained in:
Johannes 'josch' Schauer 2018-10-08 11:24:29 +02:00
parent b561b0a154
commit 594a37d093
Signed by untrusted user: josch
GPG key ID: F2CBA5C78FBD83E1

View file

@ -1066,6 +1066,9 @@ sub setup {
if ($options->{mode} eq 'unshare') {
# without the network namespace unshared, we cannot mount a new
# sysfs. Since we need network, we just bind-mount.
#
# we have to rbind because just using bind results in "wrong fs
# type, bad option, bad superblock" error
0 == system('mount', '-o', 'rbind', '/sys', "$options->{root}/sys") or die "mount failed: $?";
} else {
0 == system('mount', '-t', 'sysfs', '-o', 'nosuid,nodev,noexec', 'sys', "$options->{root}/sys") or die "mount failed: $?";