diff options
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index d605fe5e58a5..a611d1d58c7d 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -1557,15 +1557,6 @@ int do_prlimit(struct task_struct *tsk, unsigned int resource, | |||
1557 | retval = -EPERM; | 1557 | retval = -EPERM; |
1558 | if (!retval) | 1558 | if (!retval) |
1559 | retval = security_task_setrlimit(tsk, resource, new_rlim); | 1559 | retval = security_task_setrlimit(tsk, resource, new_rlim); |
1560 | if (resource == RLIMIT_CPU && new_rlim->rlim_cur == 0) { | ||
1561 | /* | ||
1562 | * The caller is asking for an immediate RLIMIT_CPU | ||
1563 | * expiry. But we use the zero value to mean "it was | ||
1564 | * never set". So let's cheat and make it one second | ||
1565 | * instead | ||
1566 | */ | ||
1567 | new_rlim->rlim_cur = 1; | ||
1568 | } | ||
1569 | } | 1560 | } |
1570 | if (!retval) { | 1561 | if (!retval) { |
1571 | if (old_rlim) | 1562 | if (old_rlim) |
@@ -1576,10 +1567,9 @@ int do_prlimit(struct task_struct *tsk, unsigned int resource, | |||
1576 | task_unlock(tsk->group_leader); | 1567 | task_unlock(tsk->group_leader); |
1577 | 1568 | ||
1578 | /* | 1569 | /* |
1579 | * RLIMIT_CPU handling. Note that the kernel fails to return an error | 1570 | * RLIMIT_CPU handling. Arm the posix CPU timer if the limit is not |
1580 | * code if it rejected the user's attempt to set RLIMIT_CPU. This is a | 1571 | * infite. In case of RLIM_INFINITY the posix CPU timer code |
1581 | * very long-standing error, and fixing it now risks breakage of | 1572 | * ignores the rlimit. |
1582 | * applications, so we live with it | ||
1583 | */ | 1573 | */ |
1584 | if (!retval && new_rlim && resource == RLIMIT_CPU && | 1574 | if (!retval && new_rlim && resource == RLIMIT_CPU && |
1585 | new_rlim->rlim_cur != RLIM_INFINITY && | 1575 | new_rlim->rlim_cur != RLIM_INFINITY && |