* [RFC][PATCH] Restore LSM hook calls to setpriority and setpgid
@ 2003-01-14 21:44 Stephen D. Smalley
0 siblings, 0 replies; only message in thread
From: Stephen D. Smalley @ 2003-01-14 21:44 UTC (permalink / raw)
To: mingo, linux-kernel; +Cc: linux-security-module, sds
This patch restores the LSM hook calls in setpriority and setpgid to
2.5.58. These hooks were previously added as of 2.5.27, but the hook
calls were subsequently lost as a result of other changes to the code
as of 2.5.37.
If anyone has any objections to these changes, please let me know.
sys.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
-----
===== kernel/sys.c 1.38 vs edited =====
--- 1.38/kernel/sys.c Thu Dec 5 21:56:43 2002
+++ edited/kernel/sys.c Tue Jan 14 16:02:15 2003
@@ -212,18 +212,25 @@
static int set_one_prio(struct task_struct *p, int niceval, int error)
{
+ int no_nice;
+
if (p->uid != current->euid &&
p->uid != current->uid && !capable(CAP_SYS_NICE)) {
error = -EPERM;
goto out;
}
-
+ if (niceval < task_nice(p) && !capable(CAP_SYS_NICE)) {
+ error = -EACCES;
+ goto out;
+ }
+ no_nice = security_task_setnice(p, niceval);
+ if (no_nice) {
+ error = no_nice;
+ goto out;
+ }
if (error == -ESRCH)
error = 0;
- if (niceval < task_nice(p) && !capable(CAP_SYS_NICE))
- error = -EACCES;
- else
- set_user_nice(p, niceval);
+ set_user_nice(p, niceval);
out:
return error;
}
@@ -944,6 +951,10 @@
}
ok_pgid:
+ err = security_task_setpgid(p, pgid);
+ if (err)
+ goto out;
+
if (p->pgrp != pgid) {
detach_pid(p, PIDTYPE_PGID);
p->pgrp = pgid;
--
Stephen Smalley, NSA
sds@epoch.ncsc.mil
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-01-14 21:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-14 21:44 [RFC][PATCH] Restore LSM hook calls to setpriority and setpgid Stephen D. Smalley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).