3 # Exercise Linux kernel proc.psinfo.label metric
5 # Copyright (c) 2013 Red Hat. All Rights Reserved.
9 echo "QA output created by $seq"
10 # get standard environment, filters and checks
17 test $PCP_VER -ge 30805 || _notrun
"No support for new proc label metric"
18 test $PCP_PLATFORM = linux || _notrun
"Test unsupported on $PCP_PLATFORM"
19 test -f /proc
/$pid/attr
/current || _notrun
"No kernel support for labels"
20 # for some kernels, /proc/$pid/attr/current exists, but attempts to
21 # access the "file" produce and Invalid argument error
23 cat /proc
/$$
/attr
/current
>/dev
/null
2>&1 || _notrun
"Incomplete kernel support for labels"
26 status
=1 # failure is the default!
27 $sudo rm -rf $tmp.
* $seq.full
28 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
30 # real QA test starts here
32 #debug# ls -l /proc/$pid/attr/current
33 syslabel
=`cat /proc/$pid/attr/current`
34 echo "SYS Label for process $pid is: $syslabel" >> $seq.full
36 pminfo
-f proc.psinfo.labels
> $tmp.labels
37 pcplabel
=`grep "^ inst \[$pid or " $tmp.labels \
38 | $PCP_AWK_PROG '{ print $NF }' \
39 | sed -e 's/^"//' -e 's/"$//'`
40 echo "PCP Label for process $pid is: $pcplabel" >> $seq.full
41 echo "Extracted from list:" >> $seq.full
42 cat $tmp.labels
>> $seq.full
44 if [ "$pcplabel" = "$syslabel" ]
46 echo "Security label for current process checks out"
49 echo "Mismatch on security labels:"
50 echo "PCP Label: $pcplabel"
51 echo "SYS Label: $syslabel"