Skip to content

No memory limit on Windows #7

Description

@natedemoss

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

infraCI, packaging, toolingjudgeAffects how solutions are scored -- distorts every published number

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions