Skip to content
/ linux Public

Commit 1f736df

Browse files
jrjohansenSasha Levin
authored andcommitted
apparmor: fix rlimit for posix cpu timers
[ Upstream commit 6ca5681 ] 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: baa73d9 ("posix-timers: Make them configurable") Reviewed-by: Georgia Garcia <georgia.garcia@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 24bb7d1 commit 1f736df

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

security/apparmor/resource.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,11 @@ void __aa_transition_rlimits(struct aa_label *old_l, struct aa_label *new_l)
201201
rules->rlimits.limits[j].rlim_max);
202202
/* soft limit should not exceed hard limit */
203203
rlim->rlim_cur = min(rlim->rlim_cur, rlim->rlim_max);
204+
if (j == RLIMIT_CPU &&
205+
rlim->rlim_cur != RLIM_INFINITY &&
206+
IS_ENABLED(CONFIG_POSIX_TIMERS))
207+
(void) update_rlimit_cpu(current->group_leader,
208+
rlim->rlim_cur);
204209
}
205210
}
206211
}

0 commit comments

Comments
 (0)