3 # Exercise pmdaproc access permission checking.
5 # Copyright (c) 2013 Red Hat.
9 echo "QA output created by $seq"
11 # get standard environment, filters and checks
17 $unix_domain_sockets || _notrun
"No unix domain socket support available"
18 $authentication || _notrun
"No authentication support available"
19 pminfo proc.nprocs
>/dev
/null
2>&1 || _notrun
"proc PMDA not installed"
21 status
=1 # failure is the default!
22 $sudo rm -rf $tmp.
* $seq.full
23 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
27 # special case these ones ...
28 # proc.psinfo.cgroups -61 No data available
29 # proc.psinfo.cgroups -12350 Metric not supported by this version of monitored application
30 # proc.psinfo.cpusallowed -12350 Metric not supported by this version of monitored application
31 # proc.psinfo.ngid -12350 Metric not supported by this version of monitored application
32 # then map any number of values to COUNT
34 sed -e '/proc.psinfo.cgroups/s/-61 No data available/1/' \
35 -e '/proc.psinfo.cgroups/s/-12350 .* application/1/' \
36 -e '/proc.psinfo.cpusallowed/s/-12350 .* application/1/' \
37 -e '/proc.psinfo.ngid/s/-12350 .* application/1/' \
38 |
$PCP_AWK_PROG '$2 > 0 { $2 = "COUNT" } { print }' \
39 | LC_COLLATE
=POSIX
sort
43 unprivileged
="proc.nprocs proc.runq"
44 privileged
="proc.psinfo proc.memory proc.id proc.fd"
47 # proc.schedstat not present in older nor newer kernels (farewell!)
48 # proc.io file permissions sometimes prevent reading after seteuid?
49 # debug: pminfo -L -K add,3,proc/pmda_proc.so,proc_init proc.io -f
51 # real QA test starts here
52 echo "== Check unprivileged metric access"
53 pmprobe
-h localhost
$unprivileged | _filter_counts
55 echo "== Check protected per-process metric fetches (expect errors)"
56 pmprobe
-h localhost
$privileged | _filter_counts
58 echo "== Check authentic per-process metric fetches (expect values)"
59 pmprobe
-h unix
: $privileged | _filter_counts