|
@@ -828,6 +828,8 @@ void __cleanup_sighand(struct sighand_struct *sighand)
|
|
|
*/
|
|
|
static void posix_cpu_timers_init_group(struct signal_struct *sig)
|
|
|
{
|
|
|
+ unsigned long cpu_limit;
|
|
|
+
|
|
|
/* Thread group counters. */
|
|
|
thread_group_cputime_init(sig);
|
|
|
|
|
@@ -842,9 +844,9 @@ static void posix_cpu_timers_init_group(struct signal_struct *sig)
|
|
|
sig->cputime_expires.virt_exp = cputime_zero;
|
|
|
sig->cputime_expires.sched_exp = 0;
|
|
|
|
|
|
- if (sig->rlim[RLIMIT_CPU].rlim_cur != RLIM_INFINITY) {
|
|
|
- sig->cputime_expires.prof_exp =
|
|
|
- secs_to_cputime(sig->rlim[RLIMIT_CPU].rlim_cur);
|
|
|
+ cpu_limit = ACCESS_ONCE(sig->rlim[RLIMIT_CPU].rlim_cur);
|
|
|
+ if (cpu_limit != RLIM_INFINITY) {
|
|
|
+ sig->cputime_expires.prof_exp = secs_to_cputime(cpu_limit);
|
|
|
sig->cputimer.running = 1;
|
|
|
}
|
|
|
|
|
@@ -1037,7 +1039,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
|
|
|
#endif
|
|
|
retval = -EAGAIN;
|
|
|
if (atomic_read(&p->real_cred->user->processes) >=
|
|
|
- p->signal->rlim[RLIMIT_NPROC].rlim_cur) {
|
|
|
+ task_rlimit(p, RLIMIT_NPROC)) {
|
|
|
if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RESOURCE) &&
|
|
|
p->real_cred->user != INIT_USER)
|
|
|
goto bad_fork_free;
|