David Peer writes:

I hope kernel people will add it to the next kernel release,

but here is one rapid fix that solves the problem.

(you will not see the new limit of 1 sec but you'll still see it set to
0, but its 1 sec - believe me && try,

if you want to see it, fork another any shell and you'll see it....bug
or feature?!)


Before the line: *old_rlim = new_rlim;


add:


if (resource == RLIMIT_CPU && new_rlim.rlim_cur == 0) {
           /*
            * The caller is asking for an immediate RLIMIT_CPU
            * expiry.  But we use the zero value to mean "it was
            * never set".  So let's cheat and make it one second
            * instead
            */
           new_rlim.rlim_cur = 1;
       }


You can remove the dumb if statement that does nothing cause the assignment 
occurs(*old_rlim = new_rlim) before

so it has no meaning! : if (rlim_cur == 0) {....}


David

-- 
setrlimit can unlimit CPU by setting to 0 seconds in some cases
https://bugs.launchpad.net/bugs/107209
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to