lkml.org 
[lkml]   [2003]   [Jan]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] LSM changes for 2.5.58
ChangeSet 1.956, 2003/01/16 14:54:42-08:00, sds@epoch.ncsc.mil

[PATCH] Restore LSM hook calls to setpriority and setpgid

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.

Ingo has signed off on this patch, and no one else has objected.


diff -Nru a/kernel/sys.c b/kernel/sys.c
--- a/kernel/sys.c Thu Jan 16 15:07:18 2003
+++ b/kernel/sys.c Thu Jan 16 15:07:18 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;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:32    [W:0.029 / U:0.776 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site