From: Jonathan Rajotte Julien Date: Fri, 21 Jul 2017 15:52:26 +0000 (-0400) Subject: Merge pull request #19 from frdeso/kprobe_fuzzing_pr X-Git-Url: http://git.liburcu.org/?a=commitdiff_plain;h=c448771aff7ae930b9e4b5f750974d096b79677b;hp=a1ae361ec3a9a41ef3e22a464cd4ebc4afae0fbc;p=lttng-ci.git Merge pull request #19 from frdeso/kprobe_fuzzing_pr Lava: Add kretprobe fuzzing test to VM tests --- diff --git a/jobs/lttng-baremetal-tests.yaml b/jobs/lttng-baremetal-tests.yaml index e1a3b6a..ab498f9 100644 --- a/jobs/lttng-baremetal-tests.yaml +++ b/jobs/lttng-baremetal-tests.yaml @@ -480,7 +480,7 @@ name: lttng-kernel-tests kversion: - linux-4.4.y - - linux-4.8.y + - linux-4.9.y - v4.8.1 lttngversion: - master diff --git a/lava/baremetal-tests/kprobe-fuzzing-tests.yml b/lava/baremetal-tests/kprobe-fuzzing-tests.yml new file mode 100644 index 0000000..8867683 --- /dev/null +++ b/lava/baremetal-tests/kprobe-fuzzing-tests.yml @@ -0,0 +1,22 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: lttng-fuzzing-kprobe-test + description: "Run kprobe fuzzing test suite" +install: + git-repos: + - url: https://github.com/lttng/lttng-ci + destination: ci + branch: master + steps: + - export TMPDIR="/tmp" + - cd + - ulimit -c unlimited + - mkdir -p coredump + - echo "$(pwd)/coredump/core.%e.%p.%h.%t" > /proc/sys/kernel/core_pattern +run: + steps: + - source /root/lttngvenv/activate + - cd ci/ + - lava-test-case run-tests --shell "./scripts/lttng-baremetal-tests/kprobe-fuzzing.sh" + - tar czf coredump.tar.gz coredump + - lava-test-case-attach run-benchmarks coredump.tar.gz diff --git a/scripts/lttng-baremetal-tests/kprobe-fuzzing.sh b/scripts/lttng-baremetal-tests/kprobe-fuzzing.sh new file mode 100755 index 0000000..254123c --- /dev/null +++ b/scripts/lttng-baremetal-tests/kprobe-fuzzing.sh @@ -0,0 +1,55 @@ +#!/bin/bash -xeu +# Copyright (C) 2017 - Francis Deslauriers +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# 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, see . + +NB_KPROBE_PER_ITER=500 +SESSION_NAME="my_kprobe_session" + +# Silence the script to avoid redirection of kallsyms to fill the screen +set +x +syms=$(awk '{print $3;}' /proc/kallsyms | sort -R) +nb_syms=$(echo "$syms" | wc -l) +set -x + +# Loop over the list of symbols and enable the symbols in groups of +# $NB_KPROBE_PER_ITER +for i in $(seq 0 "$NB_KPROBE_PER_ITER" "$nb_syms"); do + # Pick $NB_KPROBE_PER_ITER symbols to instrument, craft enable-event + # command and save them to a file. We craft the commands and executed + # them in two steps so that the pipeline can be done without the bash + # '-x' option that would fill the serial buffer because of the multiple + # pipe redirections. + set +x + echo "$syms" | head -n $((i+NB_KPROBE_PER_ITER)) | tail -n $NB_KPROBE_PER_ITER |awk '{print "lttng enable-event --kernel --function=" $1 " " $1}' > lttng-enable-event.sh + set -x + + # Print what iteration we are at + echo "$i" $((i+NB_KPROBE_PER_ITER)) + + # Destroy previous session and create a new one + lttng create "$SESSION_NAME" + + # Expect commands to fail, turn off early exit of shell script on + # non-zero return value + set +e + source ./lttng-enable-event.sh + set -e + + # Run stress util to generate some kernel activity + stress --cpu 2 --io 4 --vm 2 --vm-bytes 128M --hdd 3 --timeout 5s + + lttng list "$SESSION_NAME" + lttng destroy "$SESSION_NAME" +done diff --git a/scripts/lttng-baremetal-tests/lava-submit.py b/scripts/lttng-baremetal-tests/lava-submit.py index d2bf1ff..fc8cd3f 100644 --- a/scripts/lttng-baremetal-tests/lava-submit.py +++ b/scripts/lttng-baremetal-tests/lava-submit.py @@ -157,7 +157,7 @@ def get_config_cmd(build_device): packages=['bsdtar', 'psmisc', 'wget', 'python3', 'python3-pip', \ 'libglib2.0-dev', 'libffi-dev', 'elfutils', 'libdw-dev', \ 'libelf-dev', 'libmount-dev', 'libxml2', 'libpfm4-dev', \ - 'libnuma-dev', 'python3-dev', 'swig'] + 'libnuma-dev', 'python3-dev', 'swig', 'stress'] command = OrderedDict({ 'command': 'lava_command_run', 'parameters': { @@ -259,6 +259,11 @@ def get_kvm_tests_cmd(): 'git-repo': 'https://github.com/lttng/lttng-ci.git', 'revision': 'master', 'testdef': 'lava/baremetal-tests/destructive-tests.yml' + }, + { + 'git-repo': 'https://github.com/lttng/lttng-ci.git', + 'revision': 'master', + 'testdef': 'lava/baremetal-tests/kprobe-fuzzing-tests.yml' } ], 'timeout': 18000