sio2project / sio2jail

A tool for supervising execution of programs submitted in algorithmic competitions
MIT License
30 stars 10 forks source link

Added mremap tracing and fixed a bug in MemoryLimitListener #43

Closed mikimasn closed 7 months ago

mikimasn commented 8 months ago

Added mremap syscall tracing in the MemoryLimitListener to catch when the memory limit is exceeded and report a "memory limit exceeded" error instead of returning another possibly unrelated error (segfault, non-zero error code).

I also fixed a bug that caused the error ''memory limit exceeded'' to be displayed when there was no memory limit. ​ The error was caused by allocating more than MEMORY_LIMIT_MARGIN/2 bytes of memory in a single mmap call, which resulted in post-allocation memory usage being compared to the memory limit(which was zero).