ioi / isolate

Sandbox for securely executing untrusted programs
Other
1.1k stars 161 forks source link

Getting Resource temporarily unavailable error while compiling C program #139

Closed vikasdeepjangra closed 10 months ago

vikasdeepjangra commented 10 months ago

I'm getting the below error when trying to compile a C program

gcc: fatal error: cannot execute '/usr/lib/gcc/x86_64-linux-gnu/12/cc1': vfork: Resource temporarily unavailable

The command I'm using to compile is: isolate -b 0 -E PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --run -- /usr/bin/gcc main.c -o main

gollux commented 10 months ago

gcc is trying to create a new process, which hits the maximum number of processes allowed inside the sandbox. This limit defaults to 1 and while it can be increased, it's not recommended to do so without switching to cgroup mode. See the man page, please.

vikasdeepjangra commented 10 months ago

when I do isloate --cg --init

To initial cgroup I get the following error:

Failed to create control group /sys/fs/cgroup/memory/box-0/: No such file or directory

vikasdeepjangra commented 10 months ago

I found the fix my cgroup memory controller was not mounted. I used to below command to mount it.

mount -t cgroup -o memory none /sys/fs/cgroup/memory

PS: Make sure to restart your computer