Comment 7 for bug 394350

Kees Cook (kees) wrote :

Based on http://httpd.apache.org/docs/2.0/mod/core.html#rlimitcpu I set a 2 second soft and hard limit on the default website /etc/apache2/sites-enabled/000-default:
<VirtualHost *:80>
 ServerAdmin webmaster@localhost
 RLimitCPU 2 2
...

I put the example script above into /usr/lib/cgi-bin/test.cgi, and ran it. It was correctly killed, observed via strace:
...
[pid 10848] write(1, "2\n", 2) = 2
[pid 10848] close(1) = 0
[pid 10848] munmap(0x7f4f160ed000, 4096) = 0
[pid 10848] close(2) = 0
[pid 10848] exit_group(0) = ?
Process 10848 detached
<... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 10848
--- SIGCHLD (Child exited) @ 0 (0) ---
+++ killed by SIGKILL +++
Process 5234 detached