|
@@ -1923,6 +1923,16 @@ asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit __user *rlim)
|
|
if (retval)
|
|
if (retval)
|
|
return retval;
|
|
return retval;
|
|
|
|
|
|
|
|
+ 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;
|
|
|
|
+ }
|
|
|
|
+
|
|
task_lock(current->group_leader);
|
|
task_lock(current->group_leader);
|
|
*old_rlim = new_rlim;
|
|
*old_rlim = new_rlim;
|
|
task_unlock(current->group_leader);
|
|
task_unlock(current->group_leader);
|
|
@@ -1944,15 +1954,6 @@ asmlinkage long sys_setrlimit(unsigned int resource, struct rlimit __user *rlim)
|
|
unsigned long rlim_cur = new_rlim.rlim_cur;
|
|
unsigned long rlim_cur = new_rlim.rlim_cur;
|
|
cputime_t cputime;
|
|
cputime_t cputime;
|
|
|
|
|
|
- if (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
|
|
|
|
- */
|
|
|
|
- rlim_cur = 1;
|
|
|
|
- }
|
|
|
|
cputime = secs_to_cputime(rlim_cur);
|
|
cputime = secs_to_cputime(rlim_cur);
|
|
read_lock(&tasklist_lock);
|
|
read_lock(&tasklist_lock);
|
|
spin_lock_irq(¤t->sighand->siglock);
|
|
spin_lock_irq(¤t->sighand->siglock);
|