diff options
author | James Morris <jmorris@namei.org> | 2006-06-23 05:03:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-23 10:42:53 -0400 |
commit | 03e68060636e05989ea94bcb671ab633948f328c (patch) | |
tree | aee5e7b55f31998536dd3a4f54f38caeee6105d6 /security/selinux | |
parent | 9216dfad4fc97ab639ef0885efc713f3d7a20d5b (diff) |
[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>
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/hooks.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 093efba4d9b6..9dcf298921d4 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -2645,6 +2645,11 @@ static int selinux_task_setnice(struct task_struct *p, int nice) | |||
2645 | return task_has_perm(current,p, PROCESS__SETSCHED); | 2645 | return task_has_perm(current,p, PROCESS__SETSCHED); |
2646 | } | 2646 | } |
2647 | 2647 | ||
2648 | static int selinux_task_setioprio(struct task_struct *p, int ioprio) | ||
2649 | { | ||
2650 | return task_has_perm(current, p, PROCESS__SETSCHED); | ||
2651 | } | ||
2652 | |||
2648 | static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim) | 2653 | static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim) |
2649 | { | 2654 | { |
2650 | struct rlimit *old_rlim = current->signal->rlim + resource; | 2655 | struct rlimit *old_rlim = current->signal->rlim + resource; |
@@ -4383,6 +4388,7 @@ static struct security_operations selinux_ops = { | |||
4383 | .task_getsid = selinux_task_getsid, | 4388 | .task_getsid = selinux_task_getsid, |
4384 | .task_setgroups = selinux_task_setgroups, | 4389 | .task_setgroups = selinux_task_setgroups, |
4385 | .task_setnice = selinux_task_setnice, | 4390 | .task_setnice = selinux_task_setnice, |
4391 | .task_setioprio = selinux_task_setioprio, | ||
4386 | .task_setrlimit = selinux_task_setrlimit, | 4392 | .task_setrlimit = selinux_task_setrlimit, |
4387 | .task_setscheduler = selinux_task_setscheduler, | 4393 | .task_setscheduler = selinux_task_setscheduler, |
4388 | .task_getscheduler = selinux_task_getscheduler, | 4394 | .task_getscheduler = selinux_task_getscheduler, |