diff mbox series

[testsuite,3/3] perf_event: fix CAP_SYS_ADMIN references

Message ID 20210302172114.443689-4-omosnace@redhat.com (mailing list archive)
State Accepted
Delegated to: Ondrej Mosnáček
Headers show
Series perf_event: fixes and cleanups | expand

Commit Message

Ondrej Mosnacek March 2, 2021, 5:21 p.m. UTC
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 mbox series

Patch

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 );