CI tests: SELinux setup common for all the tests

Userspace probing needs custom SELinux setup so that systemtap
can do userspace probing using dyninst.  See check_dyninst_sebools()
in stapdyn/dynutil.cxx for details.

This update moves such SELinux setup out from the userspace-probes
testcase, and makes it common for all the systemtap CI tests.
This commit is contained in:
Martin Cermak 2021-06-14 18:44:12 +02:00
parent 107122a4e8
commit 20a55c19f6
4 changed files with 17 additions and 16 deletions

View File

@ -3,3 +3,5 @@ prepare:
script: ./plans/ci/prepare/prepare.sh script: ./plans/ci/prepare/prepare.sh
recommend: recommend:
- koji - koji
- bind-utils
- avahi-tools

View File

@ -20,10 +20,16 @@ __install_deps ()
set -xe set -xe
rpm -qa | egrep '^(kernel|systemtap)' | sort # Install needed packages
uname -r
stap-prep || __install_deps stap-prep || __install_deps
stap-prep stap-prep
# Report installed packages
stap-report
# Set up SELinux so that it allows for userspace probing
setsebool allow_execmod on
setsebool allow_execstack on
setsebool deny_ptrace off
set +xe set +xe

View File

@ -73,7 +73,12 @@ rlJournalStart
( (
perf_probe_failed "vfs_read" && exit perf_probe_failed "vfs_read" && exit
rlPhaseStart FAIL "test 1 bz1162939" rlPhaseStart FAIL "test 1 bz1162939"
rlRun "stap -vp4 -e 'probe vfs.read{println(\"hit\")}'" # At this point a weird problem shows up: sometimes the first
# systemtap invocation fails for some reason, but subsequent
# invocations succeed. Can't reproduce this manually:
rlRun "stap -vvvp4 -e 'probe vfs.read{println(\"hit\")}'" 0,1
sleep 30
rlRun "stap -vvvp4 -e 'probe vfs.read{println(\"hit\")}'" 0,1
sleep 30 sleep 30
rlRun "stap -e 'probe vfs.read{println(\"hit\")}' -c 'head -1 /etc/hosts'" rlRun "stap -e 'probe vfs.read{println(\"hit\")}' -c 'head -1 /etc/hosts'"
rlPhaseEnd rlPhaseEnd

View File

@ -52,15 +52,6 @@ rlJournalStart
rlRun "rpm -qa | fgrep -e dyninst -e systemtap | sort" rlRun "rpm -qa | fgrep -e dyninst -e systemtap | sort"
rlPhaseEnd rlPhaseEnd
rlPhaseStart FAIL "Set up SELinux"
rlRun "SEBOOL_ALLOW_EXECMOD=`getsebool allow_execmod | awk '{print $NF}'`"
rlRun "SEBOOL_ALLOW_EXECSTACK=`getsebool allow_execstack | awk '{print $NF}'`"
rlRun "SEBOOL_DENY_PTRACE=`getsebool deny_ptrace | awk '{print $NF}'`"
rlRun "setsebool allow_execmod on"
rlRun "setsebool allow_execstack on"
rlRun "setsebool deny_ptrace off"
rlPhaseEnd
rlPhaseStartSetup rlPhaseStartSetup
rlRun "cp hello.c testcase*.sh $WORKDIR" rlRun "cp hello.c testcase*.sh $WORKDIR"
rlRun "chown -R $TESTUSER:$TESTUSER $WORKDIR" rlRun "chown -R $TESTUSER:$TESTUSER $WORKDIR"
@ -94,9 +85,6 @@ rlJournalStart
rlPhaseStartCleanup rlPhaseStartCleanup
rlRun "userdel $TESTUSER" 0-255 rlRun "userdel $TESTUSER" 0-255
rlRun "rm -rf /home/$TESTUSER $WORKDIR" rlRun "rm -rf /home/$TESTUSER $WORKDIR"
rlRun "setsebool allow_execmod $SEBOOL_ALLOW_EXECMOD"
rlRun "setsebool allow_execstack $SEBOOL_ALLOW_EXECSTACK"
rlRun "setsebool deny_ptrace $SEBOOL_DENY_PTRACE"
rlPhaseEnd rlPhaseEnd
rlJournalPrintText rlJournalPrintText
rlJournalEnd rlJournalEnd