Re: [PATCH] LSM changes for 2.5.58

From: Greg KH (gregat_private)
Date: Thu Jan 16 2003 - 15:26:16 PST

  • Next message: Chris Wright: "Re: LSM: mod_reg_security"

    ChangeSet 1.956, 2003/01/16 14:54:42-08:00, sdsat_private
    
    [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;
    _______________________________________________
    linux-security-module mailing list
    linux-security-moduleat_private
    http://mail.wirex.com/mailman/listinfo/linux-security-module
    



    This archive was generated by hypermail 2b30 : Thu Jan 16 2003 - 15:32:21 PST