Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/secmodel/extensions When user_set_cpu_affinity is non-ze...



details:   https://anonhg.NetBSD.org/src/rev/9f6e6c0a0f5f
branches:  trunk
changeset: 771867:9f6e6c0a0f5f
user:      jym <jym%NetBSD.org@localhost>
date:      Sun Dec 04 21:04:51 2011 +0000

description:
When user_set_cpu_affinity is non-zero, only allow users to modify
the CPU affinity of the LWPs they own.

diffstat:

 sys/secmodel/extensions/secmodel_extensions.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 87705a7d0661 -r 9f6e6c0a0f5f sys/secmodel/extensions/secmodel_extensions.c
--- a/sys/secmodel/extensions/secmodel_extensions.c     Sun Dec 04 19:48:36 2011 +0000
+++ b/sys/secmodel/extensions/secmodel_extensions.c     Sun Dec 04 21:04:51 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: secmodel_extensions.c,v 1.1 2011/12/04 19:25:00 jym Exp $ */
+/* $NetBSD: secmodel_extensions.c,v 1.2 2011/12/04 21:04:51 jym Exp $ */
 /*-
  * Copyright (c) 2011 Elad Efrat <elad%NetBSD.org@localhost>
  * All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: secmodel_extensions.c,v 1.1 2011/12/04 19:25:00 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: secmodel_extensions.c,v 1.2 2011/12/04 21:04:51 jym Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -413,7 +413,10 @@
 
        case KAUTH_PROCESS_SCHEDULER_SETAFFINITY:
                if (user_set_cpu_affinity != 0) {
-                       result = KAUTH_RESULT_ALLOW;
+                       struct proc *p = arg0;
+
+                       if (kauth_cred_uidmatch(cred, p->p_cred))
+                               result = KAUTH_RESULT_ALLOW;
                }
                break;
 



Home | Main Index | Thread Index | Old Index