This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

kprobes test scripts


I've moved over some kprobes test scripts from CVS to our git archive at
 systemtap/scripts.  You'll see a new 'kprobes_test' directory there.

These scripts were based on some work by Gui Jian <guijian@cn.ibm.com>
posted on this list back in 2006
<http://sources.redhat.com/ml/systemtap/2006-q4/msg00435.html>.  Gui
Jian's original script tried to find kernel functions that systemtap
could probe without problems.

My modifications to his script take systemtap out of the picture.  It
generates straight "C" code to set kprobes probes in kernel functions.

To run the script, first check the config options present in
'default.cfg'.  It assumes ltp is installed in /usr/local/ltp (ltp is
used to generate a load on the system).

Then run the following (as root):

# runtest whitelist.exp

When finished (many hours and reboots later), you'll see several files
that it created:

'probes.passed' - kernel functions that had a kprobe probe registered
successfully and the probe was hit

'probes.failed' - kernel functions that had a kprobe probe registered
successfully but caused a system crash when hit

'probes.untriggered' - kernel functions that had a kprobe probe
registered successfully, but the probe was never hit during testing

'probes_unregistered' - kernel functions that could not have a kprobe
probe registered in them successfully

Note that the script will *certainly* crash the system it runs on.
Repeatedly.  When the system is rebooted, the script will automatically
continue to run where it let off until it is finished.

At startup, the script looks for a file called 'probes.all' for the list
of kernel functions to test.  If it doesn't exist, one is created that
lists all kernel functions (that are not marked as '__kprobes').  This
file is created by a script called 'readelf.py'.  To test a subset of
all kernel functions, you can either create a file called 'probes.all'
by hand or run 'readelf.py' and edit the resulting generated file.  For
instance, to only test system call functions, you could do something
like this:

# ./readelf.py
# mv probes.all probes.full
# grep ^sys_ probes.full > probes.all

There is 1 more script that needs mentioning in that directory,
'monitor_system.py'.  In my case I was running 'whitelist.exp' in a kvm
guest.  To avoid having to manually monitor the kvm guest system to see
when it had crashed, I wrote 'monitor_system.py'.  I ran it on the kvm
host system.  It monitored the kvm guest and restarted it every time the
guest didn't respond to a ping after 3 minutes.  See its comments for a
description of its config file syntax.

-- 
David Smith
dsmith@redhat.com
Red Hat
http://www.redhat.com
256.217.0141 (direct)
256.837.0057 (fax)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]