No description
Find a file
Martin Cermak 965c452664 PR33978: Avoid error: ‘__lock_task_sighand’ undeclared here
The following run time error was hit with kernel-7.0.0-0.rc2.21.fc45.x86_64:

Pass 3: translated to C into "/tmp/stap51VR9s/stap_20c366cdb7027c0ced73611307c798c0_67698_src.c" using 503848virt/263556res/19864shr/277972data kb, in 0usr/0sys/1real ms.
In file included from /usr/local/share/systemtap/runtime/linux/task_finder2.c:4,
                 from /usr/local/share/systemtap/runtime/linux/task_finder.c:15,
                 from /usr/local/share/systemtap/runtime/linux/runtime.h:347,
                 from /usr/local/share/systemtap/runtime/runtime.h:26,
                 from stap_20c366cdb7027c0ced73611307c798c0_67698_src.c:21:
/usr/local/share/systemtap/runtime/stp_utrace.c:318:17: error: ‘__lock_task_sighand’ undeclared here (not in a function); did you mean ‘unlock_task_sighand’?
  318 | typedef typeof(&__lock_task_sighand) __lock_task_sighand_fn;
      |                 ^~~~~~~~~~~~~~~~~~~
      |                 unlock_task_sighand
/usr/local/share/systemtap/runtime/stp_utrace.c: In function ‘stp_lock_task_sighand’:
/usr/local/share/systemtap/runtime/stp_utrace.c:319:72: error: invalid type argument of unary ‘*’ (have ‘int’)
  319 | #define __lock_task_sighand(a,b) ibt_wrapper(struct sighand_struct *, (* (__lock_task_sighand_fn)kallsyms___lock_task_sighand)((a), (b)))
      |                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/share/systemtap/runtime/linux/runtime.h:317:21: note: in definition of macro ‘ibt_wrapper’
  317 |   rettype retval = (function);                  \
      |                     ^~~~~~~~
/usr/local/share/systemtap/runtime/stp_utrace.c:332:15: note: in expansion of macro ‘__lock_task_sighand’
  332 |         ret = __lock_task_sighand(tsk, flags);
      |               ^~~~~~~~~~~~~~~~~~~
make[2]: *** [/usr/src/kernels/7.0.0-0.rc2.21.fc45.x86_64/scripts/Makefile.build:289: stap_20c366cdb7027c0ced73611307c798c0_67698_src.o] Error 1

This error is a consequence of upstream kernel commit e4588c25c9d122b5847b88e18b184404b6959160
which drops __lock_task_sighand() and inlined variant of function
lock_task_sighand().  Instead it does introduce lock_task_sighand()
which is not inlined.

This update uses STAPCONF_ATOMIC_DEC_AND_LOCK_EXPORTED_PR33978 as an
indirect indicator that kernel commit e4588c25c9d122b5847b88e18b184404b6959160
was applied. That seems more robust that gating on the kernel version
which is proven to be unreliable with some distribution kernels).

If kernel commit e4588c25c9d122b5847b88e18b184404b6959160 is in place,
extern struct sighand_struct *lock_task_sighand() can be directly used.
2026-03-12 16:34:56 +01:00
doc RHEL-134992: prefer to advertise "dnf debuginfo-install" 2026-02-09 15:52:03 -05:00
emacs Update emacs/systemtap-mode.el for emacs 27 2020-09-16 15:19:43 -04:00
httpd post-release 5.4 configury regen on fedora42 2025-06-07 10:43:15 -04:00
includes PR33347: autoconf the "R" .section flag in sdt.h 2025-09-01 16:29:19 -04:00
initscript rhbz2041596: replace /var/run -> /run throughout 2022-01-17 15:19:32 -05:00
interactive-notebook post-release 5.4 configury regen on fedora42 2025-06-07 10:43:15 -04:00
java post-release 5.4 configury regen on fedora42 2025-06-07 10:43:15 -04:00
language-server PR33975: GCC-16 build time issues 2026-03-12 16:34:56 +01:00
m4 autoconfigury: rebuild on Fedora 36 2022-10-11 10:50:44 -04:00
man PR33428: imply kernel<vmlinux.h> in kernel-side @cast() for type info 2025-09-15 13:07:36 -04:00
po elaborate.cxx: fix 32-bit build 2025-11-30 20:24:37 -05:00
python post-release 5.4 configury regen on fedora42 2025-06-07 10:43:15 -04:00
runtime PR33978: Avoid error: ‘__lock_task_sighand’ undeclared here 2026-03-12 16:34:56 +01:00
scripts Update scripts/dump-syscalls.sh 2025-10-31 18:53:37 +01:00
stap-exporter post-release 5.4 configury regen on fedora42 2025-06-07 10:43:15 -04:00
stapbpf post-release 5.4 configury regen on fedora42 2025-06-07 10:43:15 -04:00
stapdyn post-release 5.4 configury regen on fedora42 2025-06-07 10:43:15 -04:00
staprun post-release 5.4 configury regen on fedora42 2025-06-07 10:43:15 -04:00
tapset PR33976: Support MADV_GUARD_INSTALL and MADV_GUARD_REMOVE 2026-03-12 16:29:27 +01:00
testsuite PR33428: Test cover RHEL-143253 2026-02-09 21:33:53 +01:00
vim PR25186: tweak vim augroup name for non-conflict with some vim versions 2019-11-24 17:36:48 -05:00
.gitignore Added emacs, vscode and eclipse usage recipes 2023-02-03 11:08:56 -05:00
.mailmap AUTHORS micro canonicalization 2024-11-07 09:27:01 -05:00
ABOUT-NLS PR3823: redo autoconfigury with gettextize 2011-02-12 15:21:34 -05:00
aclocal.m4 post-release 5.4 configury regen on fedora42 2025-06-07 10:43:15 -04:00
analysis.cxx PR31242: Support namespaced include directories in Dyninst 2024-01-18 14:33:44 -05:00
analysis.h Avoid triggering error with -Werror=unused-value 2022-03-01 16:03:54 -05:00
ar-lib configury: complete auto* regeneration for AM_PROG_AR use 2020-09-18 14:05:48 -04:00
AUTHORS PRERELEASE: authors 2025-10-30 10:47:35 -04:00
AUTHORS.sh Simplify AUTHORS.sh 2009-02-18 15:28:48 -08:00
bpf-base.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
bpf-bitset.cxx Revert "Revert all bpf patches" 2017-05-08 07:24:40 -07:00
bpf-bitset.h set2: Return this from assignment operator 2021-05-19 16:29:30 -04:00
bpf-internal.h fixup for squash: bump copyyears in bpf-{base,translate} 2022-10-26 16:29:53 -04:00
bpf-opt.cxx stapbpf (for PR27030) tentative regalloc fix: zero unused regs 2020-12-15 15:43:16 -05:00
bpf-shared-globals.h pr23478 WIP: rework bpf foreach to handle multi-key array 2021-08-24 12:52:39 -04:00
bpf-translate.cxx bpf-translate.cxx: fix build against upcoming gcc-14 (-Werror=calloc-transposed-args) 2023-12-25 06:05:01 -05:00
bpf.h Revert "Revert all bpf patches" 2017-05-08 07:24:40 -07:00
buildrun.cxx PR33978: Avoid error: ‘__lock_task_sighand’ undeclared here 2026-03-12 16:34:56 +01:00
buildrun.h PR13100: build tracepoint query modules separately, concurrently 2011-10-10 05:11:45 -04:00
cache.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
cache.h PR11246 cont'd: Add options for cache control 2010-03-02 16:05:18 -08:00
client-http.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
client-http.h mechanical prerelease copyright notice year# changes 2018-10-12 16:52:23 -04:00
client-nss.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
client-nss.h mechanical prerelease copyright notice year# changes 2018-10-12 16:52:23 -04:00
cmdline.cxx PR30321 Privilege separation if invoked as root 2024-04-26 17:22:26 +02:00
cmdline.h PR30321 Privilege separation if invoked as root 2024-04-26 17:22:26 +02:00
compile configury: regenerate with autoconf 1.15 2016-03-18 12:20:15 -04:00
config.guess Update to newer config.guess to support RISC-V 2021-09-06 22:21:27 -04:00
config.in PR32788: parallelize pass-1 2025-03-12 21:56:54 -04:00
config.rpath gettextize to gettext 0.19 2015-07-09 10:55:14 -04:00
config.sub configury: regenerate with autoconf 1.15 2016-03-18 12:20:15 -04:00
configure PR33347: autoconf the "R" .section flag in sdt.h 2025-09-01 16:29:19 -04:00
configure.ac PR33347: autoconf the "R" .section flag in sdt.h 2025-09-01 16:29:19 -04:00
COPYING Fix 'incorrect-fsf-address' rpmlint errors. 2011-05-20 09:10:14 -05:00
coveragedb.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
coveragedb.h Initialize POD members that were previously uninitialized 2011-08-17 16:57:09 -04:00
csclient.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
csclient.h mechanical prerelease copyright notice year# changes 2018-10-12 16:52:23 -04:00
cscommon.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
cscommon.h Have the stap server mok sign modules using stap --sign-module=PATH 2022-04-12 11:21:01 -04:00
depcomp configury: regenerate with autoconf 1.15 2016-03-18 12:20:15 -04:00
dtrace.in dtrace.in: add emacs mode marker for python 2023-02-27 09:37:19 -05:00
dwarf_wrappers.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
dwarf_wrappers.h PR20042: support tracepoints with function-pointer args 2016-05-06 16:43:37 -07:00
dwflpp.cxx dwflpp.cxx: Prevent deref of past-the-end iterator 2025-08-14 13:01:39 -04:00
dwflpp.h PR30123: rework dwarf4/5 DW_AT_data_bit_offset support 2023-03-09 17:08:32 -05:00
elaborate.cxx elaborate.cxx: fix 32-bit build 2025-11-30 20:24:37 -05:00
elaborate.h PR30570: Improved type inference within the try block to handle elided cases 2023-06-28 09:17:49 -04:00
EXAMPLES Rename the 'examples' symlink to 'EXAMPLES' 2013-10-23 10:01:33 -07:00
git_version.sh PR31703: git_version.sh: tolerate absence of /bin/which 2024-05-06 11:37:38 -04:00
HACKING Conscious language initiatives: replaced whitelist->passlist, blacklist->blocklist, master->main/primary. Some occurences of master and slave may not be able to be replaced at this point, eg. name of a terminology or usage of other programs interface. 2020-12-02 11:51:15 -05:00
hash.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
hash.h build compatibility: drop unnecessary decl 2012-08-20 13:11:50 -04:00
INSTALL fixing configury version drift 2009-02-17 14:20:35 -05:00
install-sh configury: regenerate with autoconf 1.15 2016-03-18 12:20:15 -04:00
interactive.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
interactive.h Add initial "interactive mode" support. 2015-07-20 11:17:33 -05:00
INTERNALS interned_string: drop magic c_str() implementation 2015-08-18 13:24:16 -04:00
loc2stap.cxx loc2stap.cxx: Add partial support for DW_OP_bra in DWARF location lists 2024-04-23 14:11:18 -04:00
loc2stap.h Make declarations consistent with corresponding definitions 2021-05-05 15:19:58 -04:00
macros.systemtap.in rhbz1584705: add a %_systemtap_datadir rpm macro too 2018-07-08 11:42:47 -04:00
main.cxx PR32788: parallelize pass-1 2025-03-12 21:56:54 -04:00
Makefile.am PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
Makefile.in post-release 5.4 configury regen on fedora42 2025-06-07 10:43:15 -04:00
mdfour.c Fix minor errors found by clang analyzer 2013-10-04 17:12:04 -07:00
mdfour.h Fix 'incorrect-fsf-address' rpmlint errors. 2011-05-20 09:10:14 -05:00
missing configury: regenerate with autoconf 1.15 2016-03-18 12:20:15 -04:00
NEWS PRERELEASE: authors, news, samples index 2025-10-29 17:06:34 -04:00
nss-server-info.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
nss-server-info.h mechanical prerelease copyright notice year# changes 2018-10-12 16:52:23 -04:00
nsscommon.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
nsscommon.h Always use nssInit for http and nss server. 2018-11-06 12:09:58 -05:00
parse.cxx PR32788: parallelize pass-1 2025-03-12 21:56:54 -04:00
parse.h PR32788: parallelize pass-1 2025-03-12 21:56:54 -04:00
privilege.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
privilege.h PR 13631 and other rework of multi-privilege level support 2012-01-30 13:47:52 -05:00
py-compile Added the initial httpd/docker directory. 2017-11-14 15:39:32 -06:00
README RHEL-134992: prefer to advertise "dnf debuginfo-install" 2026-02-09 15:52:03 -05:00
README.security README.security: typo 2013-05-24 17:21:56 -04:00
README.stapregex stapregex REWRITE PROGRESS: ADD PARTIAL stapregex-dfa.cxx & related (missing emit data, some tag-reordering stuff) 2013-07-24 17:03:02 -04:00
README.unprivileged Fix spelling errors 2012-02-06 15:59:17 -05:00
remote.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
remote.h PR30321 Privilege separation if invoked as root 2024-04-26 17:22:26 +02:00
rpm_finder.cxx RHEL-134992: prefer to advertise "dnf debuginfo-install" 2026-02-09 15:52:03 -05:00
rpm_finder.h pr11564 use the --with-rpm flag to detect a missing or wrong version kernel-devel package in addition to the kernel-debuginfo. 2010-10-14 17:17:09 -04:00
run-stap.in run-stap.in: forget about bundled elfutils build mode 2020-07-11 12:37:21 -04:00
runtest.sh 2006-06-27 Roland McGrath <roland@redhat.com> 2006-06-27 21:20:53 +00:00
sdt_types.h Improve public domain dedication language. 2017-06-27 01:52:48 +02:00
session.cxx PR33925: session.cxx: don't force server/mok mode for stap -p{1,2,3} 2026-02-24 11:20:41 -05:00
session.h PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
setupdwfl.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
setupdwfl.h PR17073: module probes: support out-of-tree modules 2014-07-10 15:33:47 -04:00
smileytap.svg license: change smileytap.svg's embedded license to GPLv2 + EPL1.0 2012-10-03 15:19:00 -04:00
stap-authorize-cert.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
stap-env PR18162: map aarch64->arm64 for stap-server -a use 2015-03-25 15:53:45 -04:00
stap-gen-cert.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
stap-prep RHEL-134992: prefer to advertise "dnf debuginfo-install" 2026-02-09 15:52:03 -05:00
stap-profile-annotate.in stap-profile-annotate.in: 2022-05-11 14:04:13 -04:00
stap-report stap-report: Display amount of free and used memory in the system 2025-11-07 15:05:37 +01:00
stap-server Fix rhbz1378462 by updating the path to stap-gen-cert in stap-server. 2016-09-22 15:10:29 +02:00
stap-server.conf rhbz2041596: replace /var/run -> /run throughout 2022-01-17 15:19:32 -05:00
stap-server.service set -i as default for stap-server.service 2016-05-19 14:13:03 -04:00
stap-serverd.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
stap-sign-module.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
stap-start-server PR16309: spawn stap-serverd with / cwd 2013-12-10 12:39:32 -05:00
stap-stop-server Make stap-stop-server wait (for up to 10 seconds) for the server to quit. 2013-08-02 10:35:25 -05:00
staplog.c deprecate STP_TRANSPORT_VERSION=1 (rhel4 relayfs) 2020-09-18 14:05:48 -04:00
stapregex-defines.h stapregex PR15065 (4/8) :: switch DFA engine to an unsigned char type 2017-09-07 23:06:07 -04:00
stapregex-dfa.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
stapregex-dfa.h fix PR30395: Regex code has invalid memory reads caught by KASAN 2023-05-08 08:12:59 -04:00
stapregex-parse.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
stapregex-parse.h stapregex PR15065 (5/8) :: correctly number tags in stapregex-parse 2017-09-07 23:06:11 -04:00
stapregex-tree.cxx stapregex PR15065 (8/8) :: add back re2c's mini-optimizer 2017-09-07 23:06:28 -04:00
stapregex-tree.h stapregex PR15065 (8/8) :: add back re2c's mini-optimizer 2017-09-07 23:06:28 -04:00
stapregex.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
stapregex.h stapregex PR15065 (4/8) :: switch DFA engine to an unsigned char type 2017-09-07 23:06:07 -04:00
staptree.cxx staptree.cxx: tweak atomic<> usage for type hygiene 2025-03-18 19:48:51 -04:00
staptree.h PR32788: parallelize pass-1 2025-03-12 21:56:54 -04:00
staputil.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
staputil.h PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
stapvirt.c PR33975: GCC-16 build time issues 2026-03-12 16:34:56 +01:00
stringtable.cxx PR32788: parallelize pass-1 2025-03-12 21:56:54 -04:00
stringtable.h PR32788: parallelize pass-1 2025-03-12 21:56:54 -04:00
systemtap.spec Fix creation of the stapunpriv user (cont'd) 2025-12-02 20:17:20 +01:00
tapset-been.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
tapset-debuginfod.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
tapset-dynprobe.cxx Revert "add support of compilation against clang and llvm's libc++" 2025-01-17 20:36:16 -05:00
tapset-dynprobe.h PR14708 partial fix: Add dyninst support for '.thread.{begin,end}' probes. 2013-01-11 16:12:56 -06:00
tapset-mark.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
tapset-method.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
tapset-netfilter.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
tapset-perfmon.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
tapset-procfs.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
tapset-python.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
tapset-timers.cxx PR32856: Use STP_TIMER_DELETE_SYNC macro in generated instrumentation 2025-04-28 17:30:22 -04:00
tapset-utrace.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
tapsets.cxx PR33932: Handle kernel 6.16 DECLARE_TRACE_EVENT refactor 2026-02-26 21:12:10 -05:00
tapsets.h PR27410: Probe processes using debuginfod 2023-08-25 10:20:09 -04:00
task_finder.cxx PR32652: build compatibility with -Werror + dyninst 13 + gcc14 2025-02-06 18:24:01 -05:00
task_finder.h Consolidate task_finder/vma tracker initialization. 2010-06-11 15:22:51 +02:00
translate.cxx Deliberate syntax error reverted 2025-10-24 20:27:35 +02:00
translate.h stapregex REWRITE PROGRESS: ADD stapregex.h 2013-07-24 17:03:01 -04:00
translator-output.cxx translate.cxx: Make stap-symbols.h a separate CU. 2019-12-18 16:47:12 -08:00
translator-output.h translator: ditch one assert(0) 2020-05-28 11:25:01 -04:00
version.h PR29668 - make rpm target 2022-10-11 16:41:23 +02:00
zanata.xml Conscious language initiatives: replaced whitelist->passlist, blacklist->blocklist, master->main/primary. Some occurences of master and slave may not be able to be replaced at this point, eg. name of a terminology or usage of other programs interface. 2020-12-02 11:51:15 -05:00

systemtap: a linux trace/probe tool

Visit the project web site at <http://sourceware.org/systemtap>,
for documentation and mailing lists for developers and users.

This is free software.
See the COPYING file for redistribution/modification terms.
See the INSTALL file for generic build instructions.
See the HACKING file for contribution advice.

Prerequisites:

- linux kernel
- kernel module build environment (kernel-devel rpm) and/or dyninst
- optionally, debugging information for kernel/user-space being instrumented
- C compiler (same as what kernel was compiled with), to build kernel modules
- C++11 compiler such as gcc 4.8+, to build systemtap itself
- elfutils 0.151+ with libdwfl for debugging information parsing
- Python for tools which are scripts, such as dtrace(1)
- root privileges

Installation steps:

- If equipped with elfutils version 0.178 or later, try using debuginfod
  for automatic debuginfo downloading.  This experimental public server
  may be enough:
  % export DEBUGINFOD_URLS=https://debuginfod.elfutils.org/
  % export DEBUGINFOD_PROGRESS=1
  See https://sourceware.org/elfutils/Debuginfod.html for more details.
  
- Otherwise, install any debuginfo packages you need, for kernel
  and/or userspace.  On modern Fedora, # dnf debuginfo-install kernel [...]
  
  (Beware of confusion between kernel vs. kernel-debug vs kernel-PAE etc.
  variants.  Each likely has a corresponding development and debuginfo
  package.)

- Install the systemtap package.
  On modern Fedora, # yum install systemtap systemtap-runtime

Build steps:

- Consider installing the kernel-debuginfo, kernel-devel, gcc and
  dependent packages (or see below if you are building your own
  kernels from source).  If using only the pure-userspace dyninst
  backend, install gcc and dyninst-devel.
  
- If available, install your distribution's copy of elfutils and its
  development headers/libraries.
  Or if desired, build elfutils separately one time, and install
  it to /usr/local.
  See https://elfutils.org/
  elfutils version 0.178 introduces automatic debuginfo downloading,
  which can makes systemtap usage easier.

- On modern Fedora, install general optional build-requisites:
  # yum-builddep systemtap
  On modern Debian/Ubuntu, similarly:
  # apt-get build-dep systemtap

- Download systemtap sources:
  https://sourceware.org/systemtap/ftp/releases/
  https://sourceware.org/systemtap/ftp/snapshots/
  (or)
  git clone git://sourceware.org/git/systemtap.git
      (or) https://sourceware.org/git/systemtap.git

- Build systemtap normally:
  % .../configure [other autoconf options]
  Add env LDFLAGS=-L/path/ CPPFLAGS=-I/path/ before configure
  to locate libraries in non-system directories.

  Consider configuring with "--prefix=DIRECTORY" to specify an
  installation directory other than /usr/local.  It can be an ordinary
  personal directory.

  % make all
  # make install
  To uninstall systemtap:
  # make uninstall

  Alternately, on a Fedora-like system:
  % make rpm
  # rpm -i /path/to/rpmbuild/.../systemtap*rpm


- Run systemtap:

  To run systemtap after installation, add $prefix/bin to your $PATH, or
  refer to $prefix/bin/stap directly.  If you keep your build tree
  around, you can also use the "stap" binary there.  

  Some samples should be available under $prefix/share/doc/systemtap/examples.

  For the normal linux-kernel-module based backend, run "stap" as
  root.  If desired, create "stapdev" and "stapusr" entries in
  /etc/groups.  Any users in "stapdev"+"stapusr" will be able to run
  systemtap as if with root privileges.  Users in "stapusr" only may
  launch (with "staprun") pre-compiled probe modules (created by "stap
  -p4 ...") that a system administrator copied under
  /lib/modules/`uname -r`/systemtap.  "stapusr" may also be permitted
  to create arbitrary unprivileged systemtap scripts of their own.
  See README.unprivileged for additional setup instructions.

  To run a simple test.
  # stap -v -e 'probe vfs.read {printf("read performed\n"); exit()}'

  To run the full test suite from the build tree, install dejagnu,
  then run with root privileges:
  # make installcheck

  For the prototype dyninst pure-userspace backend, run "stap" as any user.
  % stap --runtime=dyninst -e 'probe process.function("*") { 
                               println(pn(), ":", $$parms) }' -c 'ls'

  For the prototype bpf backend, run "stap" as "root"
  # stap --runtime=bpf -e 'probe kernel.function("do_exit") {
                                 printf("bye %d\n", pid()) }'



Tips:

- By default, systemtap looks for the debug info in these locations:
  /boot/vmlinux-`uname -r`
  /usr/lib/debug/lib/modules/`uname -r`/vmlinux
  /lib/modules/`uname -r`/vmlinux
  /lib/modules/`uname -r`/build/vmlinux


Building a kernel.org kernel:

- Build the kernel using your normal procedures.  Enable
  CONFIG_DEBUG_INFO, CONFIG_KPROBES, CONFIG_RELAY, CONFIG_DEBUG_FS,
  CONFIG_MODULES, CONFIG_MODULE_UNLOAD, CONFIG_UPROBES if able
- % make modules_install install headers_install
- Boot into the kernel.

- If you wish to leave the kernel build tree in place, simply run
  % stap -r /path/to/kernel/build/tree [...]
  You're done.

- Or else, if you wish to install the kernel build/debuginfo data into
  a place where systemtap will find it without the "-r" option:
  % ln -s /path/to/kernel/build/tree /lib/modules/RELEASE/build 

- Instead of using the "-r" option, you can also use the environment 
  variable SYSTEMTAP_RELEASE to direct systemtap to the kernel data.