Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executors: make compiler fs whitelists a superset of their runtimes' #1175

Merged
merged 1 commit into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions dmoj/executors/RKT.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
class Executor(CompiledExecutor):
ext = 'rkt'
fs = [RecursiveDir('/etc/racket'), ExactFile('/etc/passwd'), ExactDir('/')]
compiler_read_fs = [
RecursiveDir('/etc/racket'),
RecursiveDir('~/.local/share/racket'),
]
compiler_read_fs = [RecursiveDir('~/.local/share/racket')]

command = 'racket'

Expand Down
10 changes: 9 additions & 1 deletion dmoj/executors/compiled_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,16 @@ def get_compile_env(self) -> Optional[Dict[str, str]]:
def get_compile_popen_kwargs(self) -> Dict[str, Any]:
return {}

def get_compiler_read_fs(self) -> List[FilesystemAccessRule]:
return self.get_fs() + self.compiler_read_fs

def get_compiler_write_fs(self) -> List[FilesystemAccessRule]:
return self.get_write_fs() + self.compiler_write_fs

def get_compiler_security(self):
sec = CompilerIsolateTracer(tmpdir=self._dir, read_fs=self.compiler_read_fs, write_fs=self.compiler_write_fs)
sec = CompilerIsolateTracer(
tmpdir=self._dir, read_fs=self.get_compiler_read_fs(), write_fs=self.get_compiler_write_fs()
)
return self._add_syscalls(sec, self.compiler_syscalls)

def create_compile_process(self, args: List[str]) -> TracedPopen:
Expand Down
1 change: 0 additions & 1 deletion dmoj/executors/mono_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class MonoExecutor(CompiledExecutor):
data_grace = 65536
cptbox_popen_class = MonoTracedPopen
fs = [RecursiveDir('/etc/mono')]
compiler_read_fs = fs
# Mono sometimes forks during its crashdump procedure, but continues even if
# the call to fork fails.
syscalls = [
Expand Down
Loading