mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
apparmor: fix rlimit for posix cpu timers
Posix cpu timers requires an additional step beyond setting the rlimit.
Refactor the code so its clear when what code is setting the
limit and conditionally update the posix cpu timers when appropriate.
Fixes: baa73d9e47 ("posix-timers: Make them configurable")
Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
acf2a94ac4
commit
6ca56813f4
1 changed files with 5 additions and 0 deletions
|
|
@ -196,6 +196,11 @@ void __aa_transition_rlimits(struct aa_label *old_l, struct aa_label *new_l)
|
|||
rules->rlimits.limits[j].rlim_max);
|
||||
/* soft limit should not exceed hard limit */
|
||||
rlim->rlim_cur = min(rlim->rlim_cur, rlim->rlim_max);
|
||||
if (j == RLIMIT_CPU &&
|
||||
rlim->rlim_cur != RLIM_INFINITY &&
|
||||
IS_ENABLED(CONFIG_POSIX_TIMERS))
|
||||
(void) update_rlimit_cpu(current->group_leader,
|
||||
rlim->rlim_cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue