STAP(1) General Commands Manual STAP(1) (NAME) stap - systemtap (SYNOPSIS) stap [ OPTIONS ] FILENAME [ ARGUMENTS ] stap [ OPTIONS ] - [ ARGUMENTS ] stap [ OPTIONS ] -e SCRIPT [ ARGUMENTS ] stap [ OPTIONS ] -l PROBE [ ARGUMENTS ] stap [ OPTIONS ] -L PROBE [ ARGUMENTS ] stap [ OPTIONS ] --dump-probe-types stap [ OPTIONS ] --dump-probe-aliases stap [ OPTIONS ] --dump-functions (DESCRIPTION) stap Systemtap . - C C Dyninst / . (FILENAME) ( - FILENAME) ( -e SCRIPT) . exit() . (SCRIPT LANGUAGE) awk C . (handlers) . << >> gdb . (DOCUMENTATION OVERVIEW) systemtap . / . / systemtap [man error::pass5] . : https://sourceware.org/systemtap +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ | (man pages) | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |stap ( ) | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |error::* | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |warning::* | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |stapprobes | $context | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |stapref | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |stappaths | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |stap-prep | debuginfo | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |tapset::* | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |probe::* | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |function::* | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |macro::* | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |stapvars | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |staprun, stapdyn, stapbpf | systemtap | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |systemtap | (initscript) | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |stap-server | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ |stapex | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ | (books) | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ | (Beginner's Guide) | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ | (Tutorial) | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ | (Language Reference) | / | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ | (Tapset Reference) | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ | (references) | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ | | | | | | +---------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------+ (OPTIONS) systemtap . . . $SYSTEMTAP_DIR/rc . ( $SYSTEMTAP_DIR $HOME/.systemtap .) . <> . - FILENAME -e SCRIPT . -h --help . -V --version . -p NUM (pass) NUM. : (parse) (elaborate) (translate) (compile) (run). (PROCESSING) . -v . . --vp ABCDE . <<--vp 002>> . <<-v --vp 00004>> . -k . C . -g (Guru). C . -P (Prologue- searching). --prologue-searching=always . $context . -u . / . -w . . -W . -b (bulk mode percpu ) . stap-merge . -i --interactive . systemtap . -t . (derivation) . -s NUM NUM . . -I DIR (tapset). . -D NAME=VALUE C Makefile . . -B NAME=VALUE (kernel-runtime) make make . kconfig . -B CONFIG_DEBUG_INFO=y . -B FLAG dyninst CFLAGS dyninst . -B -g . -a ARCH (cross-compilation) . -B CROSS_COMPILE=arch-tool-prefix- -r /build/tree . --modinfo NAME=VALUE / MODULE_INFO . . -G NAME=VALUE staprun NAME VALUE . / . -R DIR systemtap . DIR <> . -r /DIR . SYSTEMTAP_RELEASE . -r RELEASE /lib/modules/RELEASE/build. SYSTEMTAP_RELEASE . -m MODULE . . -d MODULE / (symbol/unwind) . / . --ldd / ldd -d . : . --all-modules . --all-modules <<-dkernel>> <<-d>> . : . -o FILE . (bulk mode) percpu FILE_ ( -F FILE_cpu) . strftime(3) FILE . -c CMD CMD CMD. target() pid . . : probe FOO { if (pid() != target()) next; .... } -x PID target() PID. PID . -e SCRIPT SCRIPT . -E SCRIPT SCRIPT . SCRIPT -e . (-l/-L) . -l PROBE . (wildcards) . . % stap -e 'probe syscall.* { }' [...] % stap -l 'syscall.*' syscall.accept [...] syscall.writev -L PROBE <<-l>> . -v -L (PC) . % stap -L 'process("/lib64/libpython*.so.*").mark("*")' process("/usr/lib64/libpython2.7.so.1.0").mark("function__entry") $arg1:long $arg2:long $arg3:long process("/usr/lib64/libpython2.7.so.1.0").mark("function__return") $arg1:long $arg2:long $arg3:long process("/usr/lib64/libpython3.6m.so.1.0").mark("function__entry") $arg1:long $arg2:long $arg3:long process("/usr/lib64/libpython3.6m.so.1.0").mark("function__return") $arg1:long $arg2:long $arg3:long process("/usr/lib64/libpython3.6m.so.1.0").mark("gc__done") $arg1:long process("/usr/lib64/libpython3.6m.so.1.0").mark("gc__start") $arg1:long process("/usr/lib64/libpython3.6m.so.1.0").mark("line") $arg1:long $arg2:long $arg3:long -F -o . -o staprun pid . -S size[,N] . size systemtap . N systemtap . . -T TIMEOUT TIMEOUT . --skip-badvars 0 . --prologue-searching[=WHEN] . $context . WHEN <> <> <> ( ) . WHEN <> . <> . --suppress-handler-errors : try { ... } catch { next } . MAXERRORS . MAXSKIPPED . . --compatible VERSION systemtap . systemtap . << (DEPRECATION)>> . --check-version systemtap . << (DEPRECATION)>> . --clean-cache (cache) . . << (CACHING)>> . --color[=WHEN], --colour[=WHEN] . WHEN <> <> <> ( ) . WHEN <> . <> . SYSTEMTAP_COLORS . : key1=val1:key2=val2:key3=val3 ...etc. : "error", "warning", "source", "caret", and "token". () Select Graphic Rendition (SGR) . SGR . : error=01;31:warning=00;33:source=00;34:caret=01:token=01. SYSTEMTAP_COLORS . . --disable-cache . . --poison-cache . . stap . systemtap . --privilege[=stapusr | =stapsys | =stapdev] stap ( (UNPRIVILEGED USERS) ). . stapusr stapsys ( --use-server ) . --privilege -pN N < 5 root stapdev stap --privilege . --unprivileged --privilege=stapusr . --use-server[=HOSTNAME[:PORT] | =IP_ADDRESS[:PORT] | =CERT_SERIAL] () / --list-servers --trust-servers ( ) . ( --privilege ) SSL . SSL . --use-server . IP ( --list-servers) . ( --trust-servers ). IP . . IP IPv4 IPv6 . IPv6 - (link local) (%) <>. IPv6 IPv6 ([]) <<[fe80::5eff:35ff:fe07:55ca]:5000>> <<[fe80::5eff:35ff:fe07:55ca%eth0]:5000>>. --use-server -pN N < 5 root stapdev stapusr stap --use-server . --use-server-on-error[=yes|=no] stap . no . yes . ( ) . --use-server . --list-servers[=SERVERS] SERVERS SERVERS . . : all ( SSL ). specified --use-server . online . trusted SSL . signer ( --privilege ). compatible . specified . --use-server --use-server . --list-servers avahi-daemon . --list-servers online . --list-servers IPv6 /etc/avahi/avahi-daemon.conf avahi-daemon <> . IPv6 . --trust-servers[=TRUST_SPEC] --use-server TRUST_SPEC TRUST_SPEC . : ssl SSL. signer ( --privilege ). (root) signer . all-users SSL . SSL . . all-users . revoke . . no-prompt . . ssl . --use-server . no-prompt . --sign-module MOK ( - Machine Owner Key) UEFI/SecureBoot. << (SECUREBOOT)>> . --dump-probe-types . --privilege=stapusr . --dump-probe-aliases . --dump-functions . <> . / ( <> ). rlimit ( ~stap-server/.systemtap/rc stap-server(8) ) --use-server . --remote URL . . . URL : [USER@]HOSTNAME, ssh://[USER@]HOSTNAME ssh . ssh_config SendEnv LANG . libvirt://DOMAIN, libvirt://DOMAIN/LIBVIRT_URI stapvirt libvirt . LIBVIRT_URI / . QEMU : --remote libvirt://MyDomain/qemu:///system . URI . stap stapvirt(1) . unix:PATH UNIX . virtio-serial QEMU . direct:// (loopback) . --remote-prefix <> N . --download-debuginfo[=OPTION] debuginfo abrt OPTION OPTION : yes debuginfo . OPTION --download-debuginfo . no debuginfo . . ask abrt . . . --rlimit-as=NUM ( ) . --rlimit-cpu=NUM (CPU time) . --rlimit-nproc=NUM . --rlimit-stack=NUM . --rlimit-fsize=NUM . --sysroot=DIR sysroot ( ) . -r RELEASE sysroot . -r /DIR sysroot . --sysenv=VAR=VALUE . ( PATH LD_LIBRARY_PATH) --sysroot . --suppress-time-limits -DSTP_OVERLOAD -DMAXACTION -DMAXTRYLOCK. (guru mode) . --runtime=MODE . kernel () dyninst bpf. (ALTERNATE RUNTIMES) . --dyninst --runtime=dyninst. --bpf --runtime=bpf. --save-uprobes SystemTap uprobes ( .) SystemTap ( <> ). --target-namespaces=PID PID . . stap . --monitor=INTERVAL ( uptime uid ) . INTERVAL . : c . s . t / . . r . p (pause). x / . . navigation-keys . Tab . --example . stappaths(7) . --no-global-var-display stap . --language-server (Language server). stdio . stap . --build-as . . kallsyms /proc . RPM stapunpriv stap --build-as=stapunpriv . (ARGUMENTS) . . (SCRIPT LANGUAGE) systemtap awk C . : . C . (GENERAL SYNTAX) . : # ... $# @# // ... ++C /* ... C ... */ ( C C) ( C). ( ) . 2**63 ( ). . $1 ... $ @1 ... @ . $# ( ) @# ( ) . . . (PREPROCESSING) . cond ? exp1 : exp2 : %( CONDITION %? TRUE-TOKENS %) %( CONDITION %? TRUE-TOKENS %: FALSE-TOKENS %) (CONDITION) . CONDITION ( ) || && . (&&) (||) . kernel_vr kernel_v ("2.6.13-1.322FC3smp") ("2.6.13") : <, <=, ==, !=, >, >=, - RPM . ( -r ) . glibc strverscmp . (==), (!=), (* ? [), fnmatch . arch ( ARCH/SUBARCH ) == != . . CONFIG_something == != ( "y" "m"). . . systemtap_v systemtap --compatible . kernel_v . << (DEPRECATION)>> . systemtap_privilege systemtap . == != "stapusr" "stapsys" "stapdev" . guru_mode systemtap guru_mode . == != 1 0. runtime systemtap . (ALTERNATE RUNTIMES) . == != . . CONDITION . . TRUE-TOKENS FALSE-TOKENS ( ) . 2.6.5 : %( kernel_v <= "2.6.5" %? **ERROR** %) # : probe kernel.function ( %( kernel_v <= "2.6.12" %? "__mm_do_fault" %: %( kernel_vr == "2.6.13*smp" %? "do_page_fault" %: UNSUPPORTED %) %) ) { /* ... */ } %( arch == "ia64" %? probe syscall.vliw = kernel.function("vliw_widget") {} %) (PREPROCESSOR MACROS) . : @define NAME %( BODY %) @define NAME(PARAM_1, PARAM_2, ...) %( BODY %) @ : @define foo %( x %) @define add(a,b) %( ((@a)+(@b)) %) @foo = @add(2,2) . TRUE FALSE . : // : %( CONFIG_UPROBE == "y" %? @define foo %( process.syscall %) %: @define foo %( **ERROR** %) %) // : @define foo %( %( CONFIG_UPROBE == "y" %? process.syscall %: **ERROR** %) %) @define . . . .stpm . @define . .stpm . (CONSTANTS) guru @const() . C guru . C . @const("STP_SKIP_BADVARS") @enum() . DWARF . @enum("MY_ENUM_CONSTANT") (VARIABLES) - _ $ . C. . . / . : var1 = 5 var2 = "bar" array1 [pid()] = "name" # array2 ["foo",4,i++] += 5 # // if (["hello",5,4] in array2) println ("yes") # . . systemtap . . (SAFETY AND SECURITY) . . . . . : global var1, var2, var3=4 . -G stap -p4 . staprun stap -p4 . staprun(8) . private . global . var1 var2 : private global var1=2 private var2 MAXMAPENTRIES -- (SAFETY AND SECURITY) . MAXMAPENTRIES . . global tiny_array[10], normal_array, big_array[50000] '%' . . . global wrapped_array1%[10], wrapped_array2% . $ . CONTEXT VARIABLES stapprobes(3stap) . . << (TYPECASTING)>> . ! (STATEMENTS) . . MAXACTION C . EXP . { STMT1 STMT2 ... } . . ; . . if (EXP) STMT1 [ else STMT2 ] EXP . STMT ( ) STMT () . while (EXP) STMT EXP STMT . for (EXP1; EXP2; EXP3) STMT EXP1 . EXP2 STMT EXP3 . foreach (VAR in ARRAY [ limit EXP ]) STMT VAR . . + - VAR ARRAY . @operator ARRAY + - . << (STATISTICS)>> . @count . limit EXP . EXP . foreach ([VAR1, VAR2, ...] in ARRAY [ limit EXP ]) STMT . VAR ARRAY . foreach ([VAR1, VAR2, ...] in ARRAY [INDEX1, INDEX2, ...] [ limit EXP ]) STMT . * . foreach (VAR0 = VAR in ARRAY [ limit EXP ]) STMT foreach VAR0 ARRAY[VAR] . . VAR0 ARRAY . foreach (VAR0 = VAR in ARRAY [INDEX1, INDEX2, ...] [ limit EXP ]) STMT . * . break, continue (while for foreach). return EXP EXP . return <> . next . . . try { STMT1 } catch { STMT2 } . STMT1 STMT2 . STMT2 try/catch ( ) . try { STMT1 } catch(VAR) { STMT2 } VAR. delete ARRAY[INDEX1, INDEX2, ...] ARRAY. * * ARRAY . . . delete ARRAY ARRAY. delete SCALAR SCALAR . 0 "" . (EXPRESSIONS) C awk . C . . * / % + - >> << & ^ | && || . ( ) = *= /= %= += -= >>= <<= &= ^= |= = .= + - ! ~ ++ -- < > <= >= == != =~ !~ cond ? exp1 : exp2 ( exp ) fn ([ arg1, arg2, ... ]) exp in array [exp1, exp2, ... ] in array [*, *, ... ] in array (REGULAR EXPRESSION MATCHING) . : exp =~ regex exp !~ regex ( .) POSIX grep(1) ("\1") . matched() ngroups() : if ("an example string" =~ "str(ing)") { matched(0) // -> "string" matched(1) // -> "ing" ngroups() // -> 2 } (PROBES) . (<< >> probe handler) . : probe PROBEPOINT [, PROBEPOINT] { [STMT ...] } probe PROBEPOINT [, PROBEPOINT] if (CONDITION) { [STMT ...] } << >> (probe points) . . . stapprobes(3stap) . (context) . . << >> "$" . . . systemtap (paged-in) systemtap ( ). . stapprobes(3stap) . . . $ . (arming condition) . ( ) . . ( . .) : probe timer.us(TIMER) if (enabled) { } << >> (aliases) . . (prologue) (epilogue) "=" "+=" . . . : probe syscall.read = kernel.function("sys_read") { fildes = $fd if (execname() == "init") next # } syscall.read kernel.function("sys_read") / . probe syscall.read += kernel.function("sys_read") { if (tracethis) println ($fd) } . . . probe syscall.read = kernel.function("sys_read") { fildes = $fd if (execname() == "init") next },{ if (tracethis) println ($fd) } . probe syscall.read { printf("reading fd=%d\n", fildes) if (fildes > 10) tracethis = 1 } @probewrite . . @probewrite(var) 1 var 0 . @probewrite(var) 1 var . probe foo = begin { var = 0 }, { if (@probewrite(var)) println(var) } probe foo { var = 1 } (FUNCTIONS) systemtap . ( ) ( ) . : function thisfn (arg1, arg2) { return arg1 + arg2 } . / . C . arg2 ( ) : function thatfn:string (arg1:long, arg2) { return sprint(arg1) . arg2 } . MAXNESTING C . private . : private function three:long () { return 3 } return 0 "" . (overload) . <> STAP_NEXT C . : function f() { if (condition) next; print("first function") } function f() %{ STAP_NEXT; print("second function") %} function f() { print("third function") } f() condition "third function" . (unconditionally nexted). . : function g() { print("first function") } function g(x) { print("second function") } g() -> "first function" g(1) -> "second function" . next . . . . 0 1 . . : function f():3 { if (condition) next; print("first function") } function f():1 { if (condition) next; print("second function") } function f():2 { print("third function") } . "next" . (PRINTING) . systemtap ( ). sprint* . print, sprint . println, sprintln print sprint (newline). printd, sprintd . . printdln, sprintdln printd sprintd . printf, sprintf . . printf C : %b ASCII. %b %1b %2b %4b %8b . (%b) . %c (Character). %d,%i . %m ( #) ( #) . ( ) - . %10.4m . # . %M %m . - ( ) . %10.4M . %.*M . %o . %p . %s . %u . %x . %X . %% %. # . 0 . 0x 0X . C . %#m/%#M . : a = "alice", b = "bob", p = 0x1234abcd, i = 123, j = -1, id[a] = 1234, id[b] = 4567 print("hello") Prints: hello println(b) Prints: bob\n println(a . " is " . sprint(16)) Prints: alice is 16 foreach (name in id) printdln("|", strlen(name), name, id[name]) Prints: 5|alice|1234\n3|bob|4567 printf("%c is %s; %x or %X or %p; %d or %u\n",97,a,p,p,p,j,j) Prints: a is alice; 1234abcd or 1234ABCD or 0x1234abcd; -1 or 18446744073709551615\n printf("2 bytes of kernel buffer at address %p: %2m", p, p) Prints: 2 byte of kernel buffer at address 0x1234abcd: printf("%4b", p) Prints (these values as binary data): 0x1234abcd printf("%#o %#x %#X\n", 1, 2, 3) Prints: 01 0x2 0X3 printf("%#c %#c %#c\n", 0, 9, 42) Prints: \000 \t * (STATISTICS) . Systemtap . <<< ++C . lvalue . . : . ( .) foo <<< 1 stats[pid()] <<< memsize . . << >> (on-demand) . . . lvalue . @count(v), @sum(v), @min(v), @max(v), @avg(v), @variance(v[, b]) ///// . . . foreach . Welford . . @variance(v[, b]) b (bit-shift) 0 () 62 . . . $ stap -e > 'global x probe oneshot { for(i=1;i<=5;i++) x<< 'global x probe oneshot { for(i=1;i<=5;i++) x<< ( ) . . . . () . @hist_linear(v,start,stop,interval) "start" "stop" ( ) "interval" . . @hist_log(v) . print "ASCII art" . probe timer.profile { x[1] <<< pid() x[2] <<< uid() y <<< tid() } global x // an array containing aggregates global y // a scalar probe end { foreach ([i] in x @count+) { printf ("x[%d]: avg %d = sum %d / count %d\n", i, @avg(x[i]), @sum(x[i]), @count(x[i])) println (@hist_log(x[i])) } println ("y:") println (@hist_log(y)) } (bucket) [index] . 1 N ( ) . 0 N+1 . ( ) foreach . global x probe oneshot { x <<< -100 x <<< 1 x <<< 2 x <<< 3 x <<< 100 foreach (bucket in @hist_linear(x,1,3,1)) // expecting 1 out-of-range-low bucket // 3 payload buckets // 1 out-of-range-high bucket printf("bucket %d count %d\n", bucket, @hist_linear(x,1,3,1)[bucket]) } (TYPECASTING) ( CONTEXT VARIABLES stapprobes(3stap) ) . DWARF $ @cast @var . -> [] . : foo = $param->foo; printf("x:%d y:%d\n", foo->x, foo->y) printf("my value is %d\n", ($type == 42 ? $foo : $bar)->value) printf("my parent pid is %d\n", task_parent(task_current())->tgid) @cast() . @cast(p, "type_name"[, "module"])->member p struct/union type_name member . ->subfield . {kernel,user}_{char,int,...}($p) ( stapfuncs(5) ). : -> . Systemtap . module . : . dwarf "kernel" . . "kernel" . --compatible=4.2 . debuginfo . "kernel" . GCC . . . "" . @cast(tv, "timeval", "")->tv_sec @cast(task, "task_struct", "kernel")->tgid @cast(task, "task_struct", "kernel")->fs->umask @cast $ $$ CONTEXT VARIABLES stapprobes(3stap) . guru . void* . probe foo { if ($var->type == 1) { value = @cast($var->data, "type1")->bar } else { value = @cast($var->data, "type2")->baz } print(value) } C (EMBEDDED C) guru C . %{ %} C . #include . . C %{ %} . C . . STAP_ARG_* STAP_RETVALUE . STAP_ERROR . STAP_PRINTF . STAP_RETURN . : function integer_ops (val) %{ STAP_PRINTF("%d\n", STAP_ARG_val); STAP_RETVALUE = STAP_ARG_val + 1; if (STAP_RETVALUE == 4) STAP_ERROR("wrong guess: %d", (int) STAP_RETVALUE); if (STAP_RETVALUE == 3) STAP_RETURN(0); STAP_RETVALUE ++; %} function string_ops (val) %{ strlcpy (STAP_RETVALUE, STAP_ARG_val, MAXSTRINGLEN); strlcat (STAP_RETVALUE, "one", MAXSTRINGLEN); if (strcmp (STAP_RETVALUE, "three-two-one")) STAP_RETURN("parameter should be three-two-"); %} function no_ops () %{ STAP_RETURN(); /* function inferred with no return value */ %} . C C . (rvalue) . C %{ %} . /* string */ . function add_one (val) { return val + %{ 1 %} } function add_string_two (val) { return val . %{ /* string */ "two" %} } @define SOME_STAP_MACRO %( %{ SOME_C_MACRO %} %) probe begin { printf("SOME_C_MACRO has value: %d\n", @SOME_STAP_MACRO); } C : /* pure */ C . /* stable */ C ( ) (memoized) . pure . /* unprivileged */ C . /* myproc-unprivileged */ C . /* guru */ C systemtap -g ( guru) . ( .) /* unmangled */ C ( .) . STAP_ARG_foo STAP_RETVALUE THIS->foo THIS->__retvalue . . SystemTap . /* pragma:suffix */ C C . /* unmodified-fnargs */ C . /* string */ C const char * long. C . var /* pragma:read:var */ /* pragma:write:var */ C . STAP_GLOBAL_GET_* STAP_GLOBAL_SET_* . : global var global var2[100] function increment() %{ /* pragma:read:var */ /* pragma:write:var */ /* pragma:read:var2 */ /* pragma:write:var2 */ STAP_GLOBAL_SET_var(STAP_GLOBAL_GET_var()+1); //var++ STAP_GLOBAL_SET_var2(1, 1, STAP_GLOBAL_GET_var2(1, 1)+1); //var2[1,1]++ %} C . C . . . (BUILT-INS) stappaths(7) . stapprobes(3stap) . (DEREFERENCING) @kderef() @uderef() . @kderef() @uderef() . @kderef(SIZE, addr) @uderef(SIZE, addr) addr / SIZE . SIZE . (REGISTERS) @kregister() @uregister() . @kregister() @uregister() . DWARF . @kregister(0) @uregister(5) (PROCESSING) ( *.stp) . -I << guru>> . . ( -R) . 2.6.12-23.FC3 : 2.6.12-23.FC3/*.stp 2.6.12/*.stp 2.6/*.stp *.stp. . . . . . . (<< >>) . ( "$" ) . . C /* pure */ . $ -u . ( ) . . . C Makefile . . C . . make ( Makefile) /lib/modules/VERSION/build . . . systemtap staprun . . . MAXERRORS ( ) . staprun . (ABNORMAL TERMINATION) stap SIGKILL stapio ( stap) . SIGTERM SIGINT stapio rmmod systemtap . (EXAMPLES) stapex(3stap) / (testsuite) systemtap . stappaths(7stap) . (CACHING) systemtap ( C ) ( ) . ( systemtap ) . $SYSTEMTAP_DIR/cache . cache_mb_limit ( ) ASCII (MiB) . . <<>> . cache_clean_interval_s ASCII . . (SAFETY AND SECURITY) Systemtap . . ( dyninst (ALTERNATE RUNTIMES) .) . . / . ( -- ). . -t . . guru -g C . (overload prevention) . --suppress-time-limits . . --suppress-handler-errors . (PERMISSIONS) systemtap : o (root) o stapdev stapusr o stapsys stapusr o stapusr stapdev stapusr systemtap . stapsys stapusr : o . systemtap --privilege . stap-server(8) . o --privilege=stapsys --privilege=stapusr . stapusr : o /lib/modules/VERSION/systemtap . root . o . systemtap --privilege . stap-server(8) . o --privilege=stapusr . stap staprun . Systemtap ( ) . staprun stapdev stapusr . (SECUREBOOT) SecureBoot UEFI . ( SysRq-X SecureBoot .) systemtap . systemtap MOK ( ) . : stap --use-server=HOSTNAME:PORT -e 'SCRIPT' # mok mok systemtap # mok stap : sudo mokutil --import signing_key.x509 # : stap --use-server=HOSTNAME:PORT -e 'SCRIPT' # --sign-module stap MOK . : stap --sign-module -e 'SCRIPT' # mok systemtap mok # stap : sudo mokutil --import /home/USER/.systemtap/ssl/server/moks/FINGERPRINT/signing_key.x509 # : stap --sign-module -e 'SCRIPT' # : https://sourceware.org/systemtap/wiki/SecureBoot systemtap . SYSTEMTAP_SIGN stap . (RESOURCE LIMITS) C . -D . : MAXNESTING . . MAXSTRINGLEN . MAXTRYLOCK . MAXACTION ( ) . . MAXACTION_INTERRUPTIBLE ( begin/end) (MAXACTION * 10). MAXBACKTRACE stap backtrace [u]context- unwind.stp . MAXMAPENTRIES . : global big[10000],little[5] % ( ) global big% . MAPHASHBIAS . 0 . . . MAXERRORS 0 . --suppress-handler-errors . MAXSKIPPED . systemtap -t () . -DINTERRUPTIBLE=1 . --suppress-handler-errors . MINSTACKSPACE . . MAXUPROBES (uprobes) . uprobe ( ) . STP_MAXMEMORY ( ) systemtap . . systemtap . ( kprobes/uprobes ) . STP_OVERLOAD_THRESHOLD, STP_OVERLOAD_INTERVAL . stap . STP_PROCFS_BUFSIZE procfs ( ). MAXSTRINGLEN . procfs procfs .maxsize(MAXSIZE) . . . stap -DINTERRUPTIBLE=0 . . NMI stap . stap staprun rmmod . . (UNPRIVILEGED USERS) Systemtap . systemtap (root) stapdev stapusr . systemtap . stapusr stapusr stapsys . systemtap systemtap . --privilege --use-server . README.unprivileged systemtap . --privilege=stapsys : o . --privilege=stapusr : o . o . o . . . (PROBE RESTRICTIONS) stapusr stapsys . stapusr : o begin, begin(n) o end, end(n) o error(n) o never o process.* . o timer.{jiffies,s,sec,ms,msec,us,usec,ns,nsec}(n)* o timer.hz(n) (SCRIPT LANGUAGE RESTRICTIONS) : o (-g) . o C . (RUNTIME RESTRICTIONS) : o ( -R ) . stapusr : o . o ( ) . (COMMAND LINE OPTION RESTRICTIONS) : o -g . o : -a, -B, -D, -I, -r, -R (ENVIRONMENT RESTRICTIONS) : SYSTEMTAP_RUNTIME SYSTEMTAP_TAPSET SYSTEMTAP_DEBUGINFO_PATH (TAPSET RESTRICTIONS) stapusr . . : cpu:long () exit () str_replace:string (prnt_str:string, srch_str:string, rplc_str:string) myproc-unprivileged . is_myproc 1 . . myproc-unprivileged : print_usyms (stk:string) user_int:long (addr:long) usymname:string (addr:long) stapusr . stapusr . (ALTERNATE RUNTIMES) systemtap . Systemtap (backend) : --runtime=dyninst --runtime=bpf. --runtime=dyninst Dyninst . . dyninst -c COMMAND -x PID . : stap --runtime=dyninst -c 'stap -V' -e 'probe process.function("main") { println("hi from dyninst!") }' selinux : # setsebool allow_execstack 1 --runtime=bpf (eBPF) . eBPF . . stapbpf(8) . (EXIT STATUS) systemtap 0 . stderr . -v -vp N ( ) . (-l -L) . 0 . ^C / SIGINT . (DEPRECATION) systemtap . systemtap --compatible VERSION . systemtap --check-version . NEWS . systemtap ( ) systemtap . ( systemtap) . (_) . . (FILES) stappaths(7) . (SEE ALSO) stapprobes(3stap), function::*(3stap), probe::*(3stap), tapset::*(3stap), stappaths(7), staprun(8), stapdyn(8), systemtap(8), stapvars(3stap), stapex(3stap), stap-server(8), stap-prep(1), stapref(1), awk(1), gdb(1) (BUGS) Bugzilla : http://sourceware.org/systemtap, . error::reporting(7stap), https://sourceware.org/systemtap/wiki/HowToReportBugs STAP(1)