Skip to content

Commit 68009ac

Browse files
test: firecracker-microvm#1099 jailer mount propagation
1 parent 1bb9d18 commit 68009ac

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/integration_tests/security/test_jail.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,3 +664,29 @@ def test_cgroupsv2_written_only_once(uvm_plain, cgroups_info):
664664
assert len(write_lines) == 1
665665
assert len(mkdir_lines) != len(cgroups), "mkdir equal to number of cgroups"
666666
assert len(mkdir_lines) == 1
667+
668+
669+
def test_mount_proagation_to_root(uvm_plain, tmp_path):
670+
"""
671+
Test that the jailer mounts are propagated to the root mount namespace which
672+
in this case is "SLAVE".
673+
674+
https://github.com/firecracker-microvm/firecracker/pull/1093
675+
"""
676+
test_microvm = uvm_plain
677+
678+
# Setup the environment
679+
pseudo_root_path = tmp_path / "pseudo_root"
680+
pseudo_root_path.mkdir()
681+
682+
test_microvm.jailer.exec_file = test_microvm.fc_binary_path
683+
test_microvm.jailer.extra_args = {"chroot-base-dir": str(pseudo_root_path)}
684+
685+
# Execute the test scenario
686+
test_microvm.spawn()
687+
688+
# Perform checks and assertions
689+
mount_info = subprocess.check_output(["mount"]).decode()
690+
assert "shared" in mount_info or "slave" in mount_info, (
691+
"Mount propagation type is not SLAVE"
692+
)

0 commit comments

Comments
 (0)