STAPRUN(8) | System Manager's Manual | STAPRUN(8) |
staprun - systemtap runtime
staprun [ OPTIONS ] MODULE [ MODULE-OPTIONS ]
The staprun program is the back-end of the Systemtap tool. It expects a kernel module produced by the front-end stap tool.
Splitting the systemtap tool into a front-end and a back-end allows a user to compile a systemtap script on a development machine that has the kernel development tools (needed to compile the script) and then transfer the resulting kernel module to a production machine that doesn't have any development tools installed.
Please refer to stappaths (7) for the version number, or run rpm -q systemtap (fedora/red hat) apt-get -v systemtap (ubuntu)
The staprun program supports the following options. Any other option prints a list of supported options.
MODULE is either a module path or a module name. If it is a module name, the module will be looked for in the following directory (where 'VERSION' is the output of "uname -r"):
Any additional arguments on the command line are passed to the module. One use of these additional module arguments is to set the value of global variables declared within the module.
$ stap -p4 -m mod1 -e 'global var1="foo"; probe
begin{printf("%s\n", var1); exit()}'
Running this with an additional module argument:
$ staprun mod1.ko var1="HelloWorld"
HelloWorld
Spaces and exclamation marks currently cannot be passed into global variables this way.
See the stapex(3stap) manual page for a collection of sample scripts.
Here is a very basic example of how to use staprun. First, use stap to compile a script. The stap program will report the pathname to the resulting module.
$ stap -p4 -e 'probe begin { printf("Hello World!\n");
exit() }'
/home/user/.systemtap/cache/85/stap_8553d83f78c_265.ko
Run staprun with the pathname to the module as an argument.
$ staprun /home/user/.systemtap/cache/85/stap_8553d83f78c_265.ko
Hello World!
After the staprun program installs a Systemtap kernel module, users can detach from the kernel module and reattach to it later. The -L option loads the module and automatically detaches. Users can also detach from the kernel module interactively by sending the SIGQUIT signal from the keyboard (typically by typing Ctrl-\).
To reattach to a kernel module, the staprun -A option would be used.
After staprun launched the stapio program, users can command it to switch output file to next file when it outputs to file(s) (running staprun with -o option) by sending a SIGUSR2 signal to the stapio process. When it receives SIGUSR2, it will switch output file to new file with suffix .N where N is the sequential number. For example,
$ staprun -o foo ...
outputs trace logs to foo and if it receives SIGUSR2 signal, it switches output to foo.1 file. And receiving SIGUSR2 again, it switches to foo.2 file.
Systemtap, in the default kernel-module runtime mode, is an administrative tool. It exposes kernel internal data structures and potentially private user information. See the stap(1) manual page for additional information on safety and security.
To increase system security, users of systemtap must be root, or in the stapusr group in order to execute this setuid staprun program. A user may select a particular privilege level with the stap --privilege= option, which staprun will later enforce.
Part of the privilege enforcement mechanism may require using a stap-server and administrative trust in its cryptographic signer; see the stap-server(8) manual page for a for more information.
On a kernel with FIPS mode enabled, staprun normally refuses to attempt to load systemtap-generated kernel modules. This is because on some kernels, this results in a panic. If your kernel includes corrections such as linux commit #002c77a48b47, then you can force staprun to attempt module loads anyway, by setting the STAP_FIPS_OVERRIDE environment variable to any value.
stap(1), stapprobes(3stap), stap-server(8), stapdyn(8), stapex(3stap)
Use the Bugzilla link of the project web page or our mailing list. http://sourceware.org/systemtap/, <systemtap@sourceware.org>.