Skip to content

Commit 2a147ab

Browse files
committed
Remove max_file_size option
It breaks dotnet, and it was not secure anyways; quotas are a better replacement.
1 parent bc61714 commit 2a147ab

File tree

6 files changed

+0
-62
lines changed

6 files changed

+0
-62
lines changed

cms/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ class FSQuotaSettings:
9898
@dataclass()
9999
class SandboxConfig:
100100
sandbox_implementation: str = "isolate"
101-
# Max size of each writable file during an evaluation step, in KiB.
102-
max_file_size: int = 1024 * 1024 # 1 GiB
103101
fs_quota: FSQuotaSettings | None = None
104102
# Max processes, CPU time (s), memory (KiB) for compilation runs.
105103
compilation_sandbox_max_processes: int = 1000

cms/grading/Sandbox.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ def __init__(
216216
# These are not necessarily used, but are here for API compatibility
217217
# TODO: move all other common properties here.
218218
self.box_id: int = 0
219-
self.fsize: int | None = None
220219
self.dirs: list[tuple[str | None, str, str | None]] = []
221220
self.preserve_env: bool = False
222221
self.inherit_env: list[str] = []
@@ -926,7 +925,6 @@ def __init__(self, file_cacher, name=None, temp_dir=None):
926925
self.preserve_env = False # -e
927926
self.inherit_env = [] # -E
928927
self.set_env = {} # -E
929-
self.fsize = None # -f
930928
self.stdin_file: str | None = None # -i
931929
self.stack_space: int | None = None # -k
932930
self.address_space: int | None = None # -m
@@ -1060,9 +1058,6 @@ def build_box_options(self) -> list[str]:
10601058
res += ["--env=%s" % var]
10611059
for var, value in self.set_env.items():
10621060
res += ["--env=%s=%s" % (var, value)]
1063-
if self.fsize is not None:
1064-
# Isolate wants file size as KiB.
1065-
res += ["--fsize=%d" % (self.fsize // 1024)]
10661061
if self.stdin_file is not None:
10671062
res += ["--stdin=%s" % self.inner_absolute_path(self.stdin_file)]
10681063
if self.stack_space is not None:

cms/grading/steps/evaluation.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,6 @@ def evaluation_step_before_run(
191191
else:
192192
sandbox.address_space = None
193193

194-
# config.sandbox.max_file_size is in KiB
195-
sandbox.fsize = config.sandbox.max_file_size * 1024
196-
197194
sandbox.stdin_file = stdin_redirect
198195
sandbox.stdout_file = stdout_redirect
199196
sandbox.stderr_file = "stderr.txt"

cmstestsuite/Tests.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,6 @@
458458
languages=(LANG_C,),
459459
checks=[CheckOverallScore(0, 100)]),
460460

461-
# Write a huge file
462-
463-
Test('write-big-fileio',
464-
task=batch_fileio, filenames=['write-big-fileio.%l'],
465-
languages=(LANG_C,),
466-
checks=[CheckOverallScore(0, 100)]),
467-
468461
]
469462

470463
# TODO figure out a better way to enable/disable this.........

cmstestsuite/code/write-big-fileio.c

Lines changed: 0 additions & 39 deletions
This file was deleted.

config/cms.sample.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,6 @@ twophase_commit = false
8282
# supported.
8383
sandbox_implementation = "isolate"
8484

85-
# Do not allow contestants' solutions to write files bigger than this
86-
# size (expressed in KB; defaults to 1 GB).
87-
# Note that this alone isn't secure; solutions can create multiple files
88-
# in the sandbox.
89-
max_file_size = 1_048_576
90-
9185
# If these are set, enforce a filesystem quota on sandboxes. Note that:
9286
# (1) The file system that stores isolate boxes (box_root in isolate's
9387
# config file) must have quota accounting enabled (for a tmpfs,

0 commit comments

Comments
 (0)