2009-09-01 06:20:23

by Jiri Slaby

[permalink] [raw]
Subject: Re: [PATCH 1/6] SECURITY: selinux, fix update_rlimit_cpu parameter

On 09/01/2009 12:22 AM, James Morris wrote:
> On Mon, 31 Aug 2009, Jiri Slaby wrote:
>
> [added lsm list]
>
>> diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
>> index cf41988..496e626 100644
>> --- a/security/selinux/hooks.c
>> +++ b/security/selinux/hooks.c
>> @@ -2360,7 +2360,7 @@ static void selinux_bprm_committing_creds(struct linux_binprm *bprm)
>> initrlim = init_task.signal->rlim + i;
>> rlim->rlim_cur = min(rlim->rlim_max, initrlim->rlim_cur);
>> }
>> - update_rlimit_cpu(rlim->rlim_cur);
>> + update_rlimit_cpu(current->signal->rlim[RLIMIT_CPU].rlim_cur);
>
> This doesn't look correct to me: the original code determines
> rlim->rlim_cur and then updates current to that. With your change, this
> value is not used.

No, the for loop is to alter all limits according to the init limits.

update_rlimit_cpu is called for RLIMIT_CPU to annotate scheduler about
CPU time changes (if any).

BTW this was introduced by f06febc96ba8e0af80bcc3eaec0a109e88275fac
(timers: fix itimer/many thread hang).


2009-09-01 08:49:12

by James Morris

[permalink] [raw]
Subject: Re: [PATCH 1/6] SECURITY: selinux, fix update_rlimit_cpu parameter

On Tue, 1 Sep 2009, Jiri Slaby wrote:

> > This doesn't look correct to me: the original code determines
> > rlim->rlim_cur and then updates current to that. With your change, this
> > value is not used.
>
> No, the for loop is to alter all limits according to the init limits.

Ahh, ok, I misread the code.

>
> update_rlimit_cpu is called for RLIMIT_CPU to annotate scheduler about
> CPU time changes (if any).
>
> BTW this was introduced by f06febc96ba8e0af80bcc3eaec0a109e88275fac
> (timers: fix itimer/many thread hang).
>

--
James Morris
<[email protected]>