On 12/4/19 7:14 AM, Richard Haines wrote:
Test perf_event permissions. Signed-off-by: Richard Haines <richard_c_haines@xxxxxxxxxxxxxx> --- V2 Changes: Remove neverallows from policy Check /proc/sys/kernel/perf_event_paranoid, if < 2 then bypass the capability { sys_admin } test.
diff --git a/policy/test_perf_event.te b/policy/test_perf_event.te new file mode 100644 index 0000000..bdf3938 --- /dev/null +++ b/policy/test_perf_event.te @@ -0,0 +1,104 @@ +# +######### Check watch_queue for key changes policy module ########## +# +attribute perfdomain; + +################# Allow perf_event { * } ########################## +type test_perf_t; +domain_type(test_perf_t) +unconfined_runs_test(test_perf_t) +typeattribute test_perf_t testdomain; +typeattribute test_perf_t perfdomain; + +allow test_perf_t self:capability { sys_admin }; +allow test_perf_t device_t:chr_file { ioctl open read write };
Why is device_t:chr_file access required by the perf test? What device node is being accessed?
+allow test_perf_t self:perf_event { open cpu kernel tracepoint read write }; +allow_map(test_perf_t, device_t, chr_file)
Ditto