mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
rlimits: security, add task_struct to setrlimit
Add task_struct to task_setrlimit of security_operations to be able to set rlimit of task other than current. Signed-off-by: Jiri Slaby <[email protected]> Acked-by: Eric Paris <[email protected]> Acked-by: James Morris <[email protected]>
This commit is contained in:
parent
2f7989efd4
commit
8fd00b4d70
5 changed files with 16 additions and 10 deletions
|
|
@ -3371,16 +3371,17 @@ static int selinux_task_getioprio(struct task_struct *p)
|
|||
return current_has_perm(p, PROCESS__GETSCHED);
|
||||
}
|
||||
|
||||
static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim)
|
||||
static int selinux_task_setrlimit(struct task_struct *p, unsigned int resource,
|
||||
struct rlimit *new_rlim)
|
||||
{
|
||||
struct rlimit *old_rlim = current->signal->rlim + resource;
|
||||
struct rlimit *old_rlim = p->signal->rlim + resource;
|
||||
|
||||
/* Control the ability to change the hard limit (whether
|
||||
lowering or raising it), so that the hard limit can
|
||||
later be used as a safe reset point for the soft limit
|
||||
upon context transitions. See selinux_bprm_committing_creds. */
|
||||
if (old_rlim->rlim_max != new_rlim->rlim_max)
|
||||
return current_has_perm(current, PROCESS__SETRLIMIT);
|
||||
return current_has_perm(p, PROCESS__SETRLIMIT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue