[PATCH] SELinux: Add security hook definition for getioprio and insert hooks
Add a new security hook definition for the sys_ioprio_get operation. At present, the SELinux hook function implementation for this hook is identical to the getscheduler implementation but a separate hook is introduced to allow this check to be specialized in the future if necessary. This patch also creates a helper function get_task_ioprio which handles the access check in addition to retrieving the ioprio value for the task. Signed-off-by: David Quigley <dpquigl@tycho.nsa.gov> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: James Morris <jmorris@namei.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
7a01955f99
commit
a1836a42da
@@ -2671,6 +2671,11 @@ static int selinux_task_setioprio(struct task_struct *p, int ioprio)
|
||||
return task_has_perm(current, p, PROCESS__SETSCHED);
|
||||
}
|
||||
|
||||
static int selinux_task_getioprio(struct task_struct *p)
|
||||
{
|
||||
return task_has_perm(current, p, PROCESS__GETSCHED);
|
||||
}
|
||||
|
||||
static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim)
|
||||
{
|
||||
struct rlimit *old_rlim = current->signal->rlim + resource;
|
||||
@@ -4449,6 +4454,7 @@ static struct security_operations selinux_ops = {
|
||||
.task_setgroups = selinux_task_setgroups,
|
||||
.task_setnice = selinux_task_setnice,
|
||||
.task_setioprio = selinux_task_setioprio,
|
||||
.task_getioprio = selinux_task_getioprio,
|
||||
.task_setrlimit = selinux_task_setrlimit,
|
||||
.task_setscheduler = selinux_task_setscheduler,
|
||||
.task_getscheduler = selinux_task_getscheduler,
|
||||
|
Reference in New Issue
Block a user