Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jul 2005 11:50:57 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 79597 for review
Message-ID:  <200507051150.j65BovRr075822@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=79597

Change 79597 by rwatson@rwatson_paprika on 2005/07/05 11:50:57

	Substitute CAP_SYS_ADMIN checks for suser in hwpmc, for the
	purposes of administering hwpmc availability and model.

Affected files ...

.. //depot/projects/trustedbsd/sebsd/sys/dev/hwpmc/hwpmc_mod.c#2 edit

Differences ...

==== //depot/projects/trustedbsd/sebsd/sys/dev/hwpmc/hwpmc_mod.c#2 (text+ko) ====

@@ -29,6 +29,7 @@
 __FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_mod.c,v 1.7 2005/05/01 14:11:48 jkoshy Exp $");
 
 #include <sys/param.h>
+#include <sys/capability.h>
 #include <sys/eventhandler.h>
 #include <sys/jail.h>
 #include <sys/kernel.h>
@@ -2598,7 +2599,7 @@
 		KASSERT(td == curthread,
 		    ("[pmc,%d] td != curthread", __LINE__));
 
-		if (suser(td) || jailed(td->td_ucred)) {
+		if (cap_check(td, CAP_SYS_ADMIN) || jailed(td->td_ucred)) {
 			error =  EPERM;
 			break;
 		}
@@ -2736,7 +2737,7 @@
 		if (PMC_IS_SYSTEM_MODE(mode)) {
 			if (jailed(curthread->td_ucred))
 				error = EPERM;
-			else if (suser(curthread) &&
+			else if (cap_check(curthread, CAP_SYS_ADMIN) &&
 			    (pmc_unprivileged_syspmcs == 0))
 				error = EPERM;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507051150.j65BovRr075822>