test(runner): verify sandbox isolation with a hostile program suite

This commit is contained in:
shira committed 2026-10-11 08:59:59 +03:00
1 parent afee564bf4
commit e858280d91
38 files changed
+1359 -168

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
# Disk exhaustion: the scratch tmpfs and the file size limit refuse writes
# long before the host is affected.
import os
block = b"x" * (1 << 20)
refused = []
try:
with open("/tmp/one-big-file", "wb") as stream:
for _ in range(64):
stream.write(block)
stream.flush()
except OSError as error:
refused.append("file:" + os.strerror(error.errno))
os.remove("/tmp/one-big-file")
try:
for index in range(64):
with open(f"/tmp/part-{index}", "wb") as stream:
for _ in range(4):
stream.write(block)
except OSError as error:
refused.append("tmpfs:" + os.strerror(error.errno))
print("refused" if len(refused) == 2 else f"wrote everything {refused}")