[PATCH] lsm: add task_setioprio hook
Implement an LSM hook for setting a task's IO priority, similar to the hook for setting a tasks's nice value. A previous version of this LSM hook was included in an older version of multiadm by Jan Engelhardt, although I don't recall it being submitted upstream. Also included is the corresponding SELinux hook, which re-uses the setsched permission in the proccess class. Signed-off-by: James Morris <jmorris@namei.org> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> Cc: Jan Engelhardt <jengelh@linux01.gwdg.de> Cc: Chris Wright <chrisw@sous-sol.org> Cc: Jens Axboe <axboe@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
9216dfad4f
commit
03e6806063
@@ -2645,6 +2645,11 @@ static int selinux_task_setnice(struct task_struct *p, int nice)
|
||||
return task_has_perm(current,p, PROCESS__SETSCHED);
|
||||
}
|
||||
|
||||
static int selinux_task_setioprio(struct task_struct *p, int ioprio)
|
||||
{
|
||||
return task_has_perm(current, p, PROCESS__SETSCHED);
|
||||
}
|
||||
|
||||
static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim)
|
||||
{
|
||||
struct rlimit *old_rlim = current->signal->rlim + resource;
|
||||
@@ -4383,6 +4388,7 @@ static struct security_operations selinux_ops = {
|
||||
.task_getsid = selinux_task_getsid,
|
||||
.task_setgroups = selinux_task_setgroups,
|
||||
.task_setnice = selinux_task_setnice,
|
||||
.task_setioprio = selinux_task_setioprio,
|
||||
.task_setrlimit = selinux_task_setrlimit,
|
||||
.task_setscheduler = selinux_task_setscheduler,
|
||||
.task_getscheduler = selinux_task_getscheduler,
|
||||
|
Reference in New Issue
Block a user