Skip to content

Commit 24db4dd

Browse files
committed
rlimit: Rewrite non-sensical RLIMIT_CPU comment
The comment above the function which arms RLIMIT_CPU in the posix CPU timer code makes no sense at all. It claims that the kernel does not return an error code when it rejected the attempt to set RLIMIT_CPU. That's clearly bogus as the code does an error check and the rlimit is only set and activated when the permission checks are ok. In case of a rejection an appropriate error code is returned. This is a historical and outdated comment which got dragged along even when the rlimit handling code was rewritten. Replace it with an explanation why the setup function is not called when the rlimit value is RLIM_INFINITY and how the 'disarming' is handled. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lkml.kernel.org/r/20190821192922.185511287@linutronix.de
1 parent fe0517f commit 24db4dd

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎kernel/sys.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,10 +1576,9 @@ int do_prlimit(struct task_struct *tsk, unsigned int resource,
15761576
task_unlock(tsk->group_leader);
15771577

15781578
/*
1579-
* RLIMIT_CPU handling. Note that the kernel fails to return an error
1580-
* code if it rejected the user's attempt to set RLIMIT_CPU. This is a
1581-
* very long-standing error, and fixing it now risks breakage of
1582-
* applications, so we live with it
1579+
* RLIMIT_CPU handling. Arm the posix CPU timer if the limit is not
1580+
* infite. In case of RLIM_INFINITY the posix CPU timer code
1581+
* ignores the rlimit.
15831582
*/
15841583
if (!retval && new_rlim && resource == RLIMIT_CPU &&
15851584
new_rlim->rlim_cur != RLIM_INFINITY &&

0 commit comments

Comments
 (0)