All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ondrej Mosnacek <omosnace@redhat.com>
To: selinux@vger.kernel.org
Subject: [PATCH testsuite 3/3] perf_event: fix CAP_SYS_ADMIN references
Date: Tue,  2 Mar 2021 18:21:14 +0100	[thread overview]
Message-ID: <20210302172114.443689-4-omosnace@redhat.com> (raw)
In-Reply-To: <20210302172114.443689-1-omosnace@redhat.com>

Fix the references to CAP_SYS_ADMIN in comments and variable names to
refer to CAP_PERFMON or just "capability" to avoid confusion. As of
commit 259751492b58 ("perf_event: update perf_event test for the new
CAP_PERFMON capability"), CAP_PERFMON is tested as the main capability
that gates access to perf events, rather than CAP_SYS_ADMIN, which is
now used only as a compatibility fallback.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
---
 tests/perf_event/test | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/perf_event/test b/tests/perf_event/test
index 561a634..380d9cc 100755
--- a/tests/perf_event/test
+++ b/tests/perf_event/test
@@ -6,7 +6,7 @@ BEGIN {
     $basedir =~ s|(.*)/[^/]*|$1|;
 
     $test_count = 8;
-    $sys_admin  = 0;
+    $capability = 0;
 
     # allow info to be shown during tests
     $v = $ARGV[0];
@@ -21,9 +21,9 @@ BEGIN {
 
     $level = `cat /proc/sys/kernel/perf_event_paranoid`;
     chomp($level);
-    if ( $level >= 2 ) {    # These tests require CAP_SYS_ADMIN
+    if ( $level >= 2 ) {    # These tests require CAP_PERFMON
         $test_count += 1;
-        $sys_admin = 1;
+        $capability = 1;
     }
 
     if ( $v eq "-v" ) {
@@ -56,9 +56,9 @@ print "Test perf_event\n";
 $result = system "runcon -t test_perf_t $basedir/perf_event $v $event_id";
 ok( $result eq 0 );
 
-if ($sys_admin) {
+if ($capability) {
 
-    # Deny capability { sys_admin } - EACCES perf_event_open(2)
+    # Deny capability { perfmon } - EACCES perf_event_open(2)
     $result = system
       "runcon -t test_perf_no_cap_t $basedir/perf_event $v $event_id 2>&1";
     ok( $result >> 8 eq 1 );
-- 
2.29.2


  parent reply	other threads:[~2021-03-03  4:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 17:21 [PATCH testsuite 0/3] perf_event: fixes and cleanups Ondrej Mosnacek
2021-03-02 17:21 ` [PATCH testsuite 1/3] perf_event: measure CPU 0 rather than CPU 1 Ondrej Mosnacek
2021-03-02 17:21 ` [PATCH testsuite 2/3] perf_event: fix wrong use of perf_event_open(2) API Ondrej Mosnacek
2021-03-02 17:21 ` Ondrej Mosnacek [this message]
2021-03-04 10:29 ` [PATCH testsuite 0/3] perf_event: fixes and cleanups Ondrej Mosnacek
2021-03-04 20:24   ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210302172114.443689-4-omosnace@redhat.com \
    --to=omosnace@redhat.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.