#!/bin/bash # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # runtest.sh of /tools/systemtap/Regression/syscall-get-arguments-returning-wrong-value # Description: Test for BZ#1004059 (syscall_get_arguments() returning wrong value) # Author: Martin Cermak # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # # Copyright (c) 2014 Red Hat, Inc. # # This copyrighted material is made available to anyone wishing # to use, modify, copy, or redistribute it subject to the terms # and conditions of the GNU General Public License version 2. # # This program is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public # License along with this program; if not, write to the Free # Software Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. # # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Include Beaker environment . /usr/share/beakerlib/beakerlib.sh || exit 1 ASMLINKAGE=''; uname -m | egrep 'i[36]86' && \ ASMLINKAGE='asmlinkage();' SCRIPT=$( mktemp ) cat > $SCRIPT <<-EOF probe kernel.function("sys_open") { $ASMLINKAGE if (\$filename == pointer_arg(1)) { exit(); } else { error("Possible manifestation of rhbz1004059."); } } EOF function perf_probe_failed () { probe=$1 perf probe -d $probe ||: perf probe --add $probe retval=$? test $retval -eq 0 && \ rlLogInfo "Running perf probe --add $probe PASSED" || \ rlLogInfo "Running perf probe --add $probe FAILED" perf probe -d $probe ||: if test $retval -eq 0; then return 1 else return 0 fi } rlJournalStart rlPhaseStartTest ( perf_probe_failed "sys_open" && exit stap -p4 $SCRIPT >&/dev/null && p="" || p='-P' rlRun "stap $p -v $SCRIPT -c 'cat /dev/null'" ) rm $SCRIPT rlPhaseEnd rlJournalPrintText rlJournalEnd