I'm trying to develop an online judge, like the one you'd find at SPOJ
(www.spoj.pl). I've some doubts about a specific part of the program.
The compilation is done on the server by exec()ing gcc with the source
file as its argument in a forked process. Now, a CPU time limit is
placed on the forked process using setrlimit() and on exceeding the
limit, a SIGXCPU is sent to the forked process.
Suppose someone writes a malicious code that handles the SIGXCPU
signal, so the program could basically ignorte the signal and continue
running.
What can I do to avoid this?
> Suppose someone writes a malicious code that handles the SIGXCPU
> signal, so the program could basically ignorte the signal and continue
> running.
>
> What can I do to avoid this?
Exceeding the soft limit for CPU usage is not malicious. That's what
makes it a soft limit.
DS
you don't need to avoid it you only need to detect it.
make a rule against it, if detect abuse you can disqualify the
competitor.