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 /include | |
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 'include')
-rw-r--r-- | include/linux/security.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/security.h b/include/linux/security.h index 383c320fc834..65b32a0c6207 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -577,6 +577,11 @@ struct swap_info_struct; | |||
577 | * @p contains the task_struct of process. | 577 | * @p contains the task_struct of process. |
578 | * @nice contains the new nice value. | 578 | * @nice contains the new nice value. |
579 | * Return 0 if permission is granted. | 579 | * Return 0 if permission is granted. |
580 | * @task_setioprio | ||
581 | * Check permission before setting the ioprio value of @p to @ioprio. | ||
582 | * @p contains the task_struct of process. | ||
583 | * @ioprio contains the new ioprio value | ||
584 | * Return 0 if permission is granted. | ||
580 | * @task_setrlimit: | 585 | * @task_setrlimit: |
581 | * Check permission before setting the resource limits of the current | 586 | * Check permission before setting the resource limits of the current |
582 | * process for @resource to @new_rlim. The old resource limit values can | 587 | * process for @resource to @new_rlim. The old resource limit values can |
@@ -1210,6 +1215,7 @@ struct security_operations { | |||
1210 | int (*task_getsid) (struct task_struct * p); | 1215 | int (*task_getsid) (struct task_struct * p); |
1211 | int (*task_setgroups) (struct group_info *group_info); | 1216 | int (*task_setgroups) (struct group_info *group_info); |
1212 | int (*task_setnice) (struct task_struct * p, int nice); | 1217 | int (*task_setnice) (struct task_struct * p, int nice); |
1218 | int (*task_setioprio) (struct task_struct * p, int ioprio); | ||
1213 | int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim); | 1219 | int (*task_setrlimit) (unsigned int resource, struct rlimit * new_rlim); |
1214 | int (*task_setscheduler) (struct task_struct * p, int policy, | 1220 | int (*task_setscheduler) (struct task_struct * p, int policy, |
1215 | struct sched_param * lp); | 1221 | struct sched_param * lp); |
@@ -1836,6 +1842,11 @@ static inline int security_task_setnice (struct task_struct *p, int nice) | |||
1836 | return security_ops->task_setnice (p, nice); | 1842 | return security_ops->task_setnice (p, nice); |
1837 | } | 1843 | } |
1838 | 1844 | ||
1845 | static inline int security_task_setioprio (struct task_struct *p, int ioprio) | ||
1846 | { | ||
1847 | return security_ops->task_setioprio (p, ioprio); | ||
1848 | } | ||
1849 | |||
1839 | static inline int security_task_setrlimit (unsigned int resource, | 1850 | static inline int security_task_setrlimit (unsigned int resource, |
1840 | struct rlimit *new_rlim) | 1851 | struct rlimit *new_rlim) |
1841 | { | 1852 | { |
@@ -2478,6 +2489,11 @@ static inline int security_task_setnice (struct task_struct *p, int nice) | |||
2478 | return 0; | 2489 | return 0; |
2479 | } | 2490 | } |
2480 | 2491 | ||
2492 | static inline int security_task_setioprio (struct task_struct *p, int ioprio) | ||
2493 | { | ||
2494 | return 0; | ||
2495 | } | ||
2496 | |||
2481 | static inline int security_task_setrlimit (unsigned int resource, | 2497 | static inline int security_task_setrlimit (unsigned int resource, |
2482 | struct rlimit *new_rlim) | 2498 | struct rlimit *new_rlim) |
2483 | { | 2499 | { |