lkml.org 
[lkml]   [2010]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/4] AppArmor: Fix security_task_setrlimit logic for 2.6.36 changes
On 08/28/2010 07:10 PM, John Johansen wrote:
> 2.6.36 introduced the abilitiy to specify the task that is having its
> rlimits set. Update mediation to ensure that confined tasks can only
> set their own group_leader as expected by current policy.
>
> Add TODO note about extending policy to support setting other tasks
> rlimits.
...
> --- a/security/apparmor/resource.c
> +++ b/security/apparmor/resource.c
...
> @@ -79,18 +80,21 @@ int aa_map_resource(int resource)
> *
> * Returns: 0 or error code if setting resource failed
> */
> -int aa_task_setrlimit(struct aa_profile *profile, unsigned int resource,
> - struct rlimit *new_rlim)
> +int aa_task_setrlimit(struct aa_profile *profile, struct task_struct *task,
> + unsigned int resource, struct rlimit *new_rlim)
> {
> int error = 0;
>
> - if (profile->rlimits.mask & (1 << resource) &&
> - new_rlim->rlim_max > profile->rlimits.limits[resource].rlim_max)
> -
> - error = audit_resource(profile, resource, new_rlim->rlim_max,
> - -EACCES);
> + /* TODO: extend resource control to handle non group leader tasks.
> + * AppArmor rules currently have the implicit assumption that
> + * the task having its resource set is the group leader.

Why would you want to do that? Limits are per process, so the 'task'
parameter is guaranteed to be the leader.

> + */
> + if ((task != current->group_leader) ||
> + (profile->rlimits.mask & (1 << resource) &&
> + new_rlim->rlim_max > profile->rlimits.limits[resource].rlim_max))
> + error = -EACCES;

regards,
--
js


\
 
 \ /
  Last update: 2010-08-28 20:17    [W:0.548 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site