fix(chv-muse-r11fix): nspawn 255 拒裸 --no-new-privileges 与 --directory=/(缺陷 2)
systemd 255 把裸 --no-new-privileges 当作带必填参数的选项,吞掉 下一个参数后报错(p2.log 实测);--directory=/ 也被拒,须 --ephemeral 或 --volatile。改 --no-new-privileges=yes, --directory=/ 后加 --ephemeral:根快照 + overlay,单元内除 bind 出去的目录外一律可写、用完即弃,与 P2 共享客机 rootfs 设计一致; --volatile 会把根置只读,codex 写 $HOME 下非 bind 路径会失败。 测试:CellArgvTest 断言新值、裸值不再出现。
This commit is contained in:
1 parent
d324d87529
commit
e02828c590
2 files changed
+15
-2
No files matched your search
@@ -131,9 +131,17 @@ def build_nspawn_argv(command, network="veth",
|
|||||||
"systemd-nspawn", "--quiet",
|
"systemd-nspawn", "--quiet",
|
||||||
"--machine=%s" % MACHINE,
|
"--machine=%s" % MACHINE,
|
||||||
"--directory=/",
|
"--directory=/",
|
||||||
|
# round-11 真机修复:nspawn 255 拒裸 --directory=/(须
|
||||||
|
# --ephemeral 或 --volatile),也拒裸 --no-new-privileges
|
||||||
|
#(把它当作带必填参数的选项,吞掉下一个参数后报错)。
|
||||||
|
# 选 --ephemeral:根文件系统快照 + overlay,单元内除 bind
|
||||||
|
# 出去的目录外一律可写、用完即弃——与 P2“共享客机 rootfs、
|
||||||
|
# 只 bind workspace/.codex//run/chv”的设计一致;--volatile
|
||||||
|
# 会把根置只读,codex 写 $HOME 下非 bind 路径时会失败。
|
||||||
|
"--ephemeral",
|
||||||
"--as-pid2",
|
"--as-pid2",
|
||||||
"--private-users=%d:%d" % (UID_BASE, UID_COUNT),
|
"--private-users=%d:%d" % (UID_BASE, UID_COUNT),
|
||||||
"--no-new-privileges",
|
"--no-new-privileges=yes",
|
||||||
"--system-call-filter=%s" % SYSCALL_FILTER,
|
"--system-call-filter=%s" % SYSCALL_FILTER,
|
||||||
]
|
]
|
||||||
for cap in DROP_CAPABILITIES:
|
for cap in DROP_CAPABILITIES:
|
||||||
|
|||||||
@@ -43,7 +43,12 @@ class CellArgvTest(unittest.TestCase):
|
|||||||
self.assertIn("--machine=chv-cell", argv)
|
self.assertIn("--machine=chv-cell", argv)
|
||||||
self.assertIn("--directory=/", argv)
|
self.assertIn("--directory=/", argv)
|
||||||
self.assertIn("--as-pid2", argv)
|
self.assertIn("--as-pid2", argv)
|
||||||
self.assertIn("--no-new-privileges", argv)
|
# round-11 真机修复:nspawn 255 拒裸 --no-new-privileges
|
||||||
|
#(当作带必填参数的选项)与裸 --directory=/(须
|
||||||
|
# --ephemeral/--volatile),见 p2.log 的解析报错。
|
||||||
|
self.assertIn("--no-new-privileges=yes", argv)
|
||||||
|
self.assertNotIn("--no-new-privileges", argv)
|
||||||
|
self.assertIn("--ephemeral", argv)
|
||||||
|
|
||||||
def test_muse_named_capabilities_dropped(self):
|
def test_muse_named_capabilities_dropped(self):
|
||||||
argv = CELL.build_nspawn_argv(["true"])
|
argv = CELL.build_nspawn_argv(["true"])
|
||||||
|
|||||||
Reference in new issue
Block a user