-
Notifications
You must be signed in to change notification settings - Fork 3
No memory limit on Windows #7
Copy link
Copy link
Open
Labels
infraCI, packaging, toolingCI, packaging, toolingjudgeAffects how solutions are scored -- distorts every published numberAffects how solutions are scored -- distorts every published number
Description
Activity
Metadata
Metadata
Assignees
Labels
infraCI, packaging, toolingCI, packaging, toolingjudgeAffects how solutions are scored -- distorts every published numberAffects how solutions are scored -- distorts every published number
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.