diff --git a/sys/kern/kern_resource.c b/sys/kern/kern_resource.c index 98cc4c387172..00d4d90ec39e 100644 --- a/sys/kern/kern_resource.c +++ b/sys/kern/kern_resource.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_resource.c,v 1.151 2009/03/29 01:02:50 mrg Exp $ */ +/* $NetBSD: kern_resource.c,v 1.152 2009/05/26 06:57:38 elad Exp $ */ /*- * Copyright (c) 1982, 1986, 1991, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.151 2009/03/29 01:02:50 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_resource.c,v 1.152 2009/05/26 06:57:38 elad Exp $"); #include #include @@ -229,6 +229,11 @@ donice(struct lwp *l, struct proc *chgp, int n) KASSERT(mutex_owned(chgp->p_lock)); + if (kauth_cred_geteuid(cred) && kauth_cred_getuid(cred) && + kauth_cred_geteuid(cred) != kauth_cred_geteuid(chgp->p_cred) && + kauth_cred_getuid(cred) != kauth_cred_geteuid(chgp->p_cred)) + return (EPERM); + if (n > PRIO_MAX) n = PRIO_MAX; if (n < PRIO_MIN)