eval/sandbox.py applies RLIMIT_AS, RLIMIT_NPROC, RLIMIT_FSIZE and
os.setsid() through preexec_fn, which is POSIX-only and returns None on
Windows. On Windows the only controls left are the subprocess timeout and
interpreter isolation — no memory cap at all.
This is documented in SECURITY.md, and test_memory_limit_is_enforced_on_posix
is skipped on Windows, so it is honest rather than hidden. But contributors do
develop on Windows, and a generated program that allocates without bound will
take the machine down rather than being killed.
Options: a Job Object via pywin32, or simply refusing to run the judge on
Windows without an explicit --i-know-there-are-no-limits flag. The second is
much less code and arguably the more honest interface.
preexec_fn is also unsafe in the presence of threads, and data/verify.py
calls into the judge from a ThreadPoolExecutor — worth confirming this is
actually safe as used, since Python's own docs warn about it.
eval/sandbox.pyappliesRLIMIT_AS,RLIMIT_NPROC,RLIMIT_FSIZEandos.setsid()throughpreexec_fn, which is POSIX-only and returnsNoneonWindows. On Windows the only controls left are the subprocess timeout and
interpreter isolation — no memory cap at all.
This is documented in SECURITY.md, and
test_memory_limit_is_enforced_on_posixis skipped on Windows, so it is honest rather than hidden. But contributors do
develop on Windows, and a generated program that allocates without bound will
take the machine down rather than being killed.
Options: a Job Object via
pywin32, or simply refusing to run the judge onWindows without an explicit
--i-know-there-are-no-limitsflag. The second ismuch less code and arguably the more honest interface.
preexec_fnis also unsafe in the presence of threads, anddata/verify.pycalls into the judge from a
ThreadPoolExecutor— worth confirming this isactually safe as used, since Python's own docs warn about it.