perf_event_tests
perf_event_tests copied to clipboard
Testing EACCES/EPERM generation... FAILED
i run the test with v4.13-rc1 at haswell platform under root, and some result like below
lizhijian@inn:/result/perf_event_tests/disallow_cpu_events/lkp-hsw-d01/debian-x86_64-2016-08-31.cgz/x86_64-rhel-7.2/gcc-6/5771a8c08880cdca3bfb4a3fc6d309d6bba20877/0$ cat perf_event_tests | grep -e FAILED -e NEED -e UNEX -e SKIP
Testing inherit_stat... UNEXPLAINED
Testing EACCES generation... FAILED <== diff
Testing EPERM generation... FAILED <== diff
Testing if non-existent events fail... SKIPPED
Testing hardware breakpoint overflow... UNEXPLAINED
Testing simultaneous one-shot group overflow... FAILED
Testing if we can skid into kernel... FAILED
Testing if event constraints are enforced... SKIPPED
Testing if minimized rdpmc papi-multi-attach works... FAILED
there are two different cases comparing to your uploaded results (results/haswell/haswell-4.13-rc0 ) For the EACCES, it can be passed if i run it with a normal user For the EPERM, it always failed under both root and normal user
want to know, is EACCES required under root, what's user when you run thoes cases and any idea about EPERM?
Try most recent git, it should fix the "running as root" issue.
I don't know why EPERM would fail as a normal user. What is your perf_event_paranoid setting?
thanks a lot, i try the latest code d2b3ee19c02c3f917414ef421a54186392f8c00c with perf_event_paranoid = 2
lizhijian@haswell-OptiPlex-9020:~/perf_event_tests/tests/error_returns$ ./eacces
This tries to get perf_event_open() to generate
an EACCES return.
+ Trying to attach to CPU with "any thread" set
Paranoid = 2
Properly triggered EACCES
+ Trying to attach to PID1
paranoid=2 uid=1002
Properly triggered EACCES
Testing EACCES generation... PASSED
lizhijian@haswell-OptiPlex-9020:~/perf_event_tests/tests/error_returns$ sudo ./eacces
[sudo] password for lizhijian:
This tries to get perf_event_open() to generate
an EACCES return.
+ Trying to attach to CPU with "any thread" set
Paranoid = 2
Unexpectedly opened properly.
+ Trying to attach to PID1
paranoid=2 uid=0
Was able to open as you are running as root
Testing EACCES generation... FAILED
lizhijian@haswell-OptiPlex-9020:~/perf_event_tests/tests/error_returns$ ./eperm
This tries to get perf_event_open() to generate an EPERM errno.
+ Attempting to set a breakpoint on a kernel address
Unexpectedly got: Permission denied
Testing EPERM generation... FAILED
lizhijian@haswell-OptiPlex-9020:~/perf_event_tests/tests/error_returns$ sudo ./eperm
This tries to get perf_event_open() to generate an EPERM errno.
+ Attempting to set a breakpoint on a kernel address
Was able to set kernel breakpoint because you are running as root
Testing EPERM generation... PASSED
i will try other perf_event_paranoid setting later.
and current, some cases would have different result with different user and different perf_event_paranoid
e2big eacces einval enoent eopnotsupp eperm esrch
for perf_event_paranoid with -1 and 0, the above cases are all passed under root and normal user for perf_event_paranoid with 1 and 2, above cases result like below:
root@haswell-OptiPlex-9020:/home/lizhijian/perf_event_tests/tests/error_returns# for t in e2big eacces einval enoent eopnotsupp eperm esrch ; do for s in 1 2; do echo $s >/proc/sys/kernel/perf_event_paranoid; echo -n "|$t|$s|root| "; ./$t|grep Testing | awk '{print $NF "|"}'; echo -n "|$t|$s|non-root| "; su lizhijian -c ./$t |grep Testing | awk '{print $NF "|"}'; done; done
case | paranoid | user | result |
---|---|---|---|
e2big | 1 | root | PASSED |
e2big | 1 | non-root | PASSED |
e2big | 2 | root | PASSED |
e2big | 2 | non-root | FAILED |
eacces | 1 | root | FAILED |
eacces | 1 | non-root | PASSED |
eacces | 2 | root | FAILED |
eacces | 2 | non-root | PASSED |
einval | 1 | root | PASSED |
einval | 1 | non-root | PASSED |
einval | 2 | root | PASSED |
einval | 2 | non-root | FAILED |
enoent | 1 | root | PASSED |
enoent | 1 | non-root | PASSED |
enoent | 2 | root | PASSED |
enoent | 2 | non-root | FAILED |
eopnotsupp | 1 | root | PASSED |
eopnotsupp | 1 | non-root | PASSED |
eopnotsupp | 2 | root | PASSED |
eopnotsupp | 2 | non-root | FAILED |
eperm | 1 | root | PASSED |
eperm | 1 | non-root | PASSED |
eperm | 2 | root | PASSED |
eperm | 2 | non-root | FAILED |
esrch | 1 | root | PASSED |
esrch | 1 | non-root | PASSED |
esrch | 2 | root | PASSED |
esrch | 2 | non-root | FAILED |
i'm new to perf_event_tests, so want to know is above result as expected