diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7e2d8f3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/systemtap-4.5.tar.gz diff --git a/.systemtap.metadata b/.systemtap.metadata new file mode 100644 index 0000000..cd69235 --- /dev/null +++ b/.systemtap.metadata @@ -0,0 +1 @@ +c549d5fa7aaf6a8cef3371f5757d912d41eae934 SOURCES/systemtap-4.5.tar.gz diff --git a/SOURCES/rhbz1972803.patch b/SOURCES/rhbz1972803.patch new file mode 100644 index 0000000..48dd753 --- /dev/null +++ b/SOURCES/rhbz1972803.patch @@ -0,0 +1,24 @@ +commit eaf63df6a429956bdc03f2ecd8fc2b6fa50321a8 +Author: Frank Ch. Eigler +Date: Wed Jun 23 20:16:52 2021 -0400 + + ppc64 runtime: FULL_REGS() gone + + Adapt to kernel commit 8dc7f0229b78, which dropped the titular macro + from ppc64 ptrace.h header. + +diff --git a/runtime/linux/regs.c b/runtime/linux/regs.c +index 26423164b..5c3a86c62 100644 +--- a/runtime/linux/regs.c ++++ b/runtime/linux/regs.c +@@ -182,6 +182,10 @@ static void _stp_print_regs(struct pt_regs * regs) + } + + _stp_printf("%016lX ", regs->gpr[i]); ++/* since kernel commit 8dc7f0229 */ ++#ifndef FULL_REGS ++#define FULL_REGS(r) true ++#endif + if (i == 13 && !FULL_REGS(regs)) + break; + } diff --git a/SOURCES/rhbz1972805.patch b/SOURCES/rhbz1972805.patch new file mode 100644 index 0000000..4c95f78 --- /dev/null +++ b/SOURCES/rhbz1972805.patch @@ -0,0 +1,52 @@ +commit 5409ddea1a007384b9c71a78e8dd2cbca1fc5424 +Author: Frank Ch. Eigler +Date: Thu Jul 1 14:41:06 2021 -0400 + + rhbz1972805: add basic syscall-in-ptregs support for s390x + + Akin to commit 7be7af0fda36 for ARM, add basic syscalls via + tracepoints / CONTEXT->sregs support for s390x. The argno=6 case is + funny because for syscalls they travel in registers, whereas normally + they hop onto the stack. + +diff --git a/tapset/s390/registers.stp b/tapset/s390/registers.stp +index b3986cdd9..cbe7e8483 100644 +--- a/tapset/s390/registers.stp ++++ b/tapset/s390/registers.stp +@@ -136,7 +136,10 @@ function uarch_bytes:long() { + function _stp_get_register_by_offset:long (offset:long) %{ /* pure */ + long value; + struct pt_regs *regs; +- regs = (CONTEXT->user_mode_p ? CONTEXT->uregs : CONTEXT->kregs); ++ if (CONTEXT->sregs) ++ regs = CONTEXT->sregs; ++ else ++ regs = (CONTEXT->user_mode_p ? CONTEXT->uregs : CONTEXT->kregs); + if (!regs) { + CONTEXT->last_error = "No registers available in this context"; + return; +@@ -169,9 +172,10 @@ function _stp_sign_extend32:long (value:long) { + } + + function _stp_register:long (name:string, sign_extend:long) { +- assert(registers_valid(), "cannot access CPU registers in this context") ++ # don't assert this: will get *regs state checked in _stp_get_register_by_offset, and better ++ # assert(registers_valid(), "cannot access CPU registers in this context") + offset = _reg_offsets[name] +- assert(offset != 0 || (name in _reg_offsets), "Unknown register: " . name) ++ assert(offset != 0 || (name in _reg_offsets), "Unknown register: " . name) + value = _stp_get_register_by_offset(offset) + if (probing_32bit_app()) { + if (sign_extend) +@@ -235,8 +239,10 @@ function _stp_arg2:long (argnum:long, sign_extend:long, truncate:long, + val = u_register("r5") + else if (argnum == 5) + val = u_register("r6") ++ else if (argnum == 6 && %{ CONTEXT->sregs != NULL %} ) // linux syscall arg6 goes into r7 ++ val = u_register("r7") + else if (argnum >= 6) +- val = _stp_get_kernel_stack_param(argnum - 6) ++ val = _stp_get_kernel_stack_param(argnum - 6); + + if ((truncate || @__compat_task) && !force64) { + /* High bits may be garbage. */ diff --git a/SOURCES/rhbz1972828.patch b/SOURCES/rhbz1972828.patch new file mode 100644 index 0000000..9598ac8 --- /dev/null +++ b/SOURCES/rhbz1972828.patch @@ -0,0 +1,29 @@ +commit 515a6a2d63cdf16c5bc599f0d29283289219d9a4 +Author: Frank Ch. Eigler +Date: Thu Jun 24 13:30:38 2021 -0400 + + rhbz1972828: tapsets: iommu tracepoints + + Disable detection of intel-iommu tracepoint family on non-x86 + platforms, because the 5.13ish kernel headers for this tracepoint + include references to functions like clcache_flush_range which don't + exist on all non-x86. + +diff --git a/tapsets.cxx b/tapsets.cxx +index a5e41129f..20e0cb68f 100644 +--- a/tapsets.cxx ++++ b/tapsets.cxx +@@ -11930,6 +11930,13 @@ static vector tracepoint_extra_decls (systemtap_session& s, + they_live.push_back ("#include "); + } + ++ if (header.find("intel_iommu") != string::npos && s.architecture != "x86_64" && s.architecture != "i386") ++ { ++ // need asm/cacheflush.h for clflush_cache_range() used in that header, ++ // but this function does not exist on e.g. ppc ++ they_live.push_back ("#error nope"); ++ } ++ + if (header.find("wbt") != string::npos) + { + // blk-wbt.h gets included as "../../../block/blk-wbt.h", so we diff --git a/SOURCES/rhbz1982908.patch b/SOURCES/rhbz1982908.patch new file mode 100644 index 0000000..f7bc9f1 --- /dev/null +++ b/SOURCES/rhbz1982908.patch @@ -0,0 +1,222 @@ +commit 04b43f48f1091bdc4bfdbabae86745547e539f8c +Author: Frank Ch. Eigler +Date: Mon Jul 26 15:49:15 2021 -0400 + + releng: ditch custom pie/ssp CFLAGS engine in configure.ac + + Just inherit the desired c*flags from autoconf via environment + variables from the distro spec files. This lets us automatically + benefit from centralized hardening flags on some distros. OTOH + distros without that now will need to add such settings to the build + scripts that invoke this configure script. + +diff --git a/configure b/configure +index 3830ca898..55ff87330 100755 +--- a/configure ++++ b/configure +@@ -904,8 +904,6 @@ with_libiconv_prefix + with_libintl_prefix + enable_prologues + enable_sdt_probes +-enable_ssp +-enable_pie + with_debuginfod + enable_sqlite + enable_translator +@@ -1609,8 +1607,6 @@ Optional Features: + --disable-rpath do not hardcode runtime library paths + --enable-prologues make -P prologue-searching default + --disable-sdt-probes disable process.mark probes in stap, staprun, stapio +- --disable-ssp disable gcc stack-protector +- --enable-pie enable position-independent-executable + --enable-sqlite build with sqlite support + --disable-translator build only runtime utilities + --enable-crash[=DIRECTORY] +@@ -10269,82 +10265,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + fi + +-# Check whether --enable-ssp was given. +-if test "${enable_ssp+set}" = set; then : +- enableval=$enable_ssp; +-fi +- +-if test "x$enable_ssp" != xno; then : +- +- save_CFLAGS="$CFLAGS" +- save_CXXFLAGS="$CXXFLAGS" +- CXXFLAGS="-Werror -fstack-protector-all -D_FORTIFY_SOURCE=2 $CXXFLAGS" +- CFLAGS="-Werror -fstack-protector-all -D_FORTIFY_SOURCE=2 $CFLAGS" +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +-int something (); +-_ACEOF +-if ac_fn_c_try_compile "$LINENO"; then : +- +- { $as_echo "$as_me:${as_lineno-$LINENO}: Compiling with gcc -fstack-protector-all et al." >&5 +-$as_echo "$as_me: Compiling with gcc -fstack-protector-all et al." >&6;} +- CFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2 $save_CFLAGS" +- CXXFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2 $save_CXXFLAGS" +-else +- +- { $as_echo "$as_me:${as_lineno-$LINENO}: Compiler does not support -fstack-protector-all et al." >&5 +-$as_echo "$as_me: Compiler does not support -fstack-protector-all et al." >&6;} +- CFLAGS="$save_CFLAGS" +- CXXFLAGS="$save_CXXFLAGS" +-fi +-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +-fi +- +- +- +- +-# Compiling with fPIE by default (but see PR 9922) +-# Check whether --enable-pie was given. +-if test "${enable_pie+set}" = set; then : +- enableval=$enable_pie; +-fi +- +-if test "x$enable_pie" != xno; then : +- +- PIECFLAGS='-fPIE' +- PIECXXFLAGS='-fPIE' +- PIELDFLAGS='-pie -Wl,-z,relro -Wl,-z,now' +- save_CFLAGS="$CFLAGS" +- save_CXXFLAGS="$CXXFLAGS" +- save_LDFLAGS="$LDFLAGS" +- CFLAGS="$CFLAGS $PIECFLAGS" +- CXXFLAGS="$CXXFLAGS $PIECXXFLAGS" +- LDFLAGS="$LDFLAGS $PIELDFLAGS" +- cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +-void main () {} +-_ACEOF +-if ac_fn_c_try_link "$LINENO"; then : +- +- { $as_echo "$as_me:${as_lineno-$LINENO}: Compiling with gcc pie et al." >&5 +-$as_echo "$as_me: Compiling with gcc pie et al." >&6;} +- +-else +- +- { $as_echo "$as_me:${as_lineno-$LINENO}: Compiler does not support -pie et al." >&5 +-$as_echo "$as_me: Compiler does not support -pie et al." >&6;} +- PIECFLAGS="" +- PIECXXFLAGS="" +- PIELDFLAGS="" +- +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +- CFLAGS="$save_CFLAGS" +- CXXFLAGS="$save_CXXFLAGS" +- LDFLAGS="$save_LDFLAGS" +- +-fi + + + +diff --git a/configure.ac b/configure.ac +index d4fd9e1b0..a88c20bff 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -190,60 +190,8 @@ AS_IF([test "x$HAVE_CXX11" != x1],[ + AC_LANG_POP(C++) + ]) + +-AC_ARG_ENABLE([ssp], +- [AS_HELP_STRING([--disable-ssp], [disable gcc stack-protector])]) +-AS_IF([test "x$enable_ssp" != xno],[ +- save_CFLAGS="$CFLAGS" +- save_CXXFLAGS="$CXXFLAGS" +- CXXFLAGS="-Werror -fstack-protector-all -D_FORTIFY_SOURCE=2 $CXXFLAGS" +- CFLAGS="-Werror -fstack-protector-all -D_FORTIFY_SOURCE=2 $CFLAGS" +- AC_COMPILE_IFELSE([AC_LANG_SOURCE([int something ();])], [ +- AC_MSG_NOTICE([Compiling with gcc -fstack-protector-all et al.]) +- CFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2 $save_CFLAGS" +- CXXFLAGS="-fstack-protector-all -D_FORTIFY_SOURCE=2 $save_CXXFLAGS"],[ +- AC_MSG_NOTICE([Compiler does not support -fstack-protector-all et al.]) +- CFLAGS="$save_CFLAGS" +- CXXFLAGS="$save_CXXFLAGS"])]) +- +- +-dnl Link with gold if possible +-dnl but: https://bugzilla.redhat.com/show_bug.cgi?id=636603 +-dnl +-dnl AC_PATH_PROG(GOLD, [ld.gold], [no]) +-dnl if test "x$GOLD" != "xno" +-dnl then +-dnl mkdir -p Bdir +-dnl ln -sf $GOLD Bdir/ld +-dnl LDFLAGS="$LDFLAGS -B`pwd`/Bdir/" +-dnl AC_MSG_NOTICE([using ld.gold to link]) +-dnl fi +- +- +-# Compiling with fPIE by default (but see PR 9922) +-AC_ARG_ENABLE([pie], +- [AS_HELP_STRING([--enable-pie], [enable position-independent-executable])]) +-AS_IF([test "x$enable_pie" != xno],[ +- PIECFLAGS='-fPIE' +- PIECXXFLAGS='-fPIE' +- PIELDFLAGS='-pie -Wl,-z,relro -Wl,-z,now' +- save_CFLAGS="$CFLAGS" +- save_CXXFLAGS="$CXXFLAGS" +- save_LDFLAGS="$LDFLAGS" +- CFLAGS="$CFLAGS $PIECFLAGS" +- CXXFLAGS="$CXXFLAGS $PIECXXFLAGS" +- LDFLAGS="$LDFLAGS $PIELDFLAGS" +- AC_LINK_IFELSE([AC_LANG_SOURCE([void main () {}])], [ +- AC_MSG_NOTICE([Compiling with gcc pie et al.]) +- ], [ +- AC_MSG_NOTICE([Compiler does not support -pie et al.]) +- PIECFLAGS="" +- PIECXXFLAGS="" +- PIELDFLAGS="" +- ]) +- CFLAGS="$save_CFLAGS" +- CXXFLAGS="$save_CXXFLAGS" +- LDFLAGS="$save_LDFLAGS" +-]) ++dnl Carry forward some empty PIE*FLAGS so we don't have to modify ++dnl all the Makefile.am's just now. + AC_SUBST(PIELDFLAGS) + AC_SUBST(PIECFLAGS) + AC_SUBST(PIECXXFLAGS) +diff --git a/systemtap.spec b/systemtap.spec +index e5224e902..a2458b4b5 100644 +--- a/systemtap.spec ++++ b/systemtap.spec +@@ -11,7 +11,6 @@ + %endif + %{!?with_rpm: %global with_rpm 1} + %{!?elfutils_version: %global elfutils_version 0.179} +-%{!?pie_supported: %global pie_supported 1} + %{!?with_boost: %global with_boost 0} + %ifarch %{ix86} x86_64 ppc ppc64 ppc64le aarch64 + %{!?with_dyninst: %global with_dyninst 0%{?fedora} >= 18 || 0%{?rhel} >= 7} +@@ -589,14 +588,6 @@ systemtap-runtime-virthost machine to execute systemtap scripts. + %global docs_config --enable-docs=prebuilt + %endif + +-# Enable pie as configure defaults to disabling it +-%if %{pie_supported} +-%global pie_config --enable-pie +-%else +-%global pie_config --disable-pie +-%endif +- +- + %if %{with_java} + %global java_config --with-java=%{_jvmdir}/java + %else +@@ -646,8 +637,8 @@ systemtap-runtime-virthost machine to execute systemtap scripts. + # We don't ship compileworthy python code, just oddball samples + %global py_auto_byte_compile 0 + +-%configure %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} %{httpd_config} %{bpf_config} %{debuginfod_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}" +-make %{?_smp_mflags} ++%configure %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} %{httpd_config} %{bpf_config} %{debuginfod_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}" ++make %{?_smp_mflags} V=1 + + + %install diff --git a/SOURCES/rhbz1985124.patch b/SOURCES/rhbz1985124.patch new file mode 100644 index 0000000..22ef5a0 --- /dev/null +++ b/SOURCES/rhbz1985124.patch @@ -0,0 +1,1091 @@ +commit 7c2751e37f97e95d77898d68b7c08cbf1be7f7d9 +Author: Sultan Alsawaf +Date: Mon Jul 12 15:31:36 2021 -0500 + + task_finder_vma: add autoconf check for hlist_add_tail_rcu() + + The 3.10 version check for hlist_add_tail_rcu() only works for RHEL + kernels. Kernels older than 4.7 that lack the hlist_add_tail_rcu() backport + won't compile (such as Debian kernels). Add an autoconf stub to know for + certain if hlist_add_tail_rcu() is present. + +diff --git a/buildrun.cxx b/buildrun.cxx +index ba3daa0a0..0c244db72 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -520,6 +520,8 @@ compile_pass (systemtap_session& s) + "STAPCONF_ATOMIC_FETCH_ADD_UNLESS", NULL); + output_autoconf(s, o, cs, "autoconf-lockdown-debugfs.c", "STAPCONF_LOCKDOWN_DEBUGFS", NULL); + output_autoconf(s, o, cs, "autoconf-lockdown-kernel.c", "STAPCONF_LOCKDOWN_KERNEL", NULL); ++ output_autoconf(s, o, cs, "autoconf-hlist_add_tail_rcu.c", ++ "STAPCONF_HLIST_ADD_TAIL_RCU", NULL); + + // used by runtime/linux/netfilter.c + output_exportconf(s, o2, "nf_register_hook", "STAPCONF_NF_REGISTER_HOOK"); +diff --git a/runtime/linux/autoconf-hlist_add_tail_rcu.c b/runtime/linux/autoconf-hlist_add_tail_rcu.c +new file mode 100644 +index 000000000..2c4660837 +--- /dev/null ++++ b/runtime/linux/autoconf-hlist_add_tail_rcu.c +@@ -0,0 +1,6 @@ ++#include ++ ++void foo(struct hlist_node *n, struct hlist_head *h) ++{ ++ hlist_add_tail_rcu(n, h); ++} + +commit ef5a8b9eda402e4e96c4e3ce01e7ff95d3e10470 +Author: Du Zhe +Date: Tue Jul 13 19:11:55 2021 -0400 + + runtime: fix unintended compile error with autoconf-x86-uniregs.c + + Adding a #include restores this test on the gentoo + linux-5.10.47-gentoo kernel. + +diff --git a/runtime/linux/autoconf-x86-uniregs.c b/runtime/linux/autoconf-x86-uniregs.c +index 25729c220..232c18670 100644 +--- a/runtime/linux/autoconf-x86-uniregs.c ++++ b/runtime/linux/autoconf-x86-uniregs.c +@@ -1,3 +1,4 @@ ++#include + #include + + #if defined (__i386__) || defined (__x86_64__) + +commit 968173f7fb97675de94c8ca47e6b6898b1117a1d +Author: Frank Ch. Eigler +Date: Tue Jul 13 19:34:50 2021 -0400 + + runtime: linux 5.14 compat: + + Linux commit f39650de687e3 moved some kernel decls around. + +diff --git a/buildrun.cxx b/buildrun.cxx +index 0c244db72..a1332a687 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -383,7 +383,8 @@ compile_pass (systemtap_session& s) + output_exportconf(s, o2, "cpu_khz", "STAPCONF_CPU_KHZ"); + output_exportconf(s, o2, "__module_text_address", "STAPCONF_MODULE_TEXT_ADDRESS"); + output_exportconf(s, o2, "add_timer_on", "STAPCONF_ADD_TIMER_ON"); +- ++ output_autoconf(s, o, cs, "autoconf-514-panic.c", "STAPCONF_514_PANIC", NULL); ++ + output_dual_exportconf(s, o2, "probe_kernel_read", "probe_kernel_write", "STAPCONF_PROBE_KERNEL"); + output_autoconf(s, o, cs, "autoconf-hw_breakpoint_context.c", + "STAPCONF_HW_BREAKPOINT_CONTEXT", NULL); +diff --git a/runtime/linux/autoconf-514-panic.c b/runtime/linux/autoconf-514-panic.c +new file mode 100644 +index 000000000..57b1a0026 +--- /dev/null ++++ b/runtime/linux/autoconf-514-panic.c +@@ -0,0 +1,3 @@ ++#include ++ ++void* c = & panic_notifier_list; +diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c +index 32ef99da6..9b9d6cbe2 100644 +--- a/runtime/transport/transport.c ++++ b/runtime/transport/transport.c +@@ -24,6 +24,9 @@ + #ifdef STAPCONF_LOCKDOWN_DEBUGFS + #include + #endif ++#ifdef STAPCONF_514_PANIC ++#include ++#endif + #include "../uidgid_compatibility.h" + + static int _stp_exit_flag = 0; + +commit a29f65d5750f6379afeca99c5d641598ff638517 +Author: Stan Cox +Date: Sun Jul 18 21:32:51 2021 -0400 + + PR28079: Adapt to kernel 5.14 task_struct.__state change + + Use signal_wake_up_state for the 5.14 kernel which changed volatile long state to unsigned int __state. + +diff --git a/buildrun.cxx b/buildrun.cxx +index a1332a687..ae27ddea4 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -523,6 +523,7 @@ compile_pass (systemtap_session& s) + output_autoconf(s, o, cs, "autoconf-lockdown-kernel.c", "STAPCONF_LOCKDOWN_KERNEL", NULL); + output_autoconf(s, o, cs, "autoconf-hlist_add_tail_rcu.c", + "STAPCONF_HLIST_ADD_TAIL_RCU", NULL); ++ output_autoconf(s, o, cs, "autoconf-task-state.c", "STAPCONF_TASK_STATE", NULL); + + // used by runtime/linux/netfilter.c + output_exportconf(s, o2, "nf_register_hook", "STAPCONF_NF_REGISTER_HOOK"); +diff --git a/runtime/linux/autoconf-task-state.c b/runtime/linux/autoconf-task-state.c +new file mode 100644 +index 000000000..27a1d7c13 +--- /dev/null ++++ b/runtime/linux/autoconf-task-state.c +@@ -0,0 +1,18 @@ ++/* ++ * Is this a kernel prior to the following kernel commit: ++ * ++ * commit 2f064a59a11ff9bc22e52e9678bc601404c7cb34 ++ * Author: Peter Zijlstra ++ * Date: 2021-06-11 10:28:17 +0200 ++ * ++ * sched: Change task_struct::state ++ * Change the type and name of task_struct::state. Drop the volatile and ++ * shrink it to an 'unsigned int'. Rename it in order to find all uses ++ * such that we can use READ_ONCE/WRITE_ONCE as appropriate. ++ */ ++ ++#include ++ ++unsigned int bar (struct task_struct *foo) { ++ return (foo->state = 0); ++} +diff --git a/runtime/stp_utrace.c b/runtime/stp_utrace.c +index ff8c5549d..d63e6366c 100644 +--- a/runtime/stp_utrace.c ++++ b/runtime/stp_utrace.c +@@ -33,9 +33,12 @@ + #if defined(__set_task_state) + #define __stp_set_task_state(tsk, state_value) \ + __set_task_state((tsk), (state_value)) +-#else ++#elif defined(STAPCONF_TASK_STATE) + #define __stp_set_task_state(tsk, state_value) \ + do { (tsk)->state = (state_value); } while (0) ++#else ++#define __stp_set_task_state(tsk, state_value) \ ++ signal_wake_up_state((tsk), (state_value)) + #endif + + // For now, disable the task_work_queue on non-RT kernels. +@@ -1263,7 +1266,7 @@ static void utrace_wakeup(struct task_struct *target, struct utrace *utrace) + spin_lock_irq(&target->sighand->siglock); + if (target->signal->flags & SIGNAL_STOP_STOPPED || + target->signal->group_stop_count) +- target->state = TASK_STOPPED; ++ __stp_set_task_state(target, TASK_STOPPED); + else + stp_wake_up_state(target, __TASK_TRACED); + spin_unlock_irq(&target->sighand->siglock); + +commit ffb0a38ea0ded9561233ffcb2d9b52a46ddf70ed +Author: Frank Ch. Eigler +Date: Thu Jul 22 19:16:12 2021 -0400 + + runtime: adapt to -Werror=implicit-fallthrough=5 + + Linux kbuild commit d936eb23874 sets $subject CFLAGS, so to play + catch-up, we also need to use gcc attribute(fallthrough) to label such + spots in switch() statements in our runtime / tapset. Tested on + linux5.14 gcc11 rawhide and linux3.10 gcc4 rhel7. + +diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h +index 035f0bd97..e57d10a8a 100644 +--- a/runtime/linux/runtime.h ++++ b/runtime/linux/runtime.h +@@ -65,6 +65,22 @@ + static void *kallsyms_copy_to_kernel_nofault; + #endif + ++ ++/* A fallthrough; macro to let the runtime survive -Wimplicit-fallthrough=5 */ ++/* from */ ++#ifndef fallthrough ++#if __GNUC__ < 5 ++# define fallthrough do {} while (0) /* fallthrough */ ++#else ++#if __has_attribute(__fallthrough__) ++# define fallthrough __attribute__((__fallthrough__)) ++#else ++# define fallthrough do {} while (0) /* fallthrough */ ++#endif ++#endif ++#endif ++ ++ + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,23) + #include + #endif +diff --git a/runtime/map-gen.c b/runtime/map-gen.c +index aeeab38bf..47317d61f 100644 +--- a/runtime/map-gen.c ++++ b/runtime/map-gen.c +@@ -112,9 +112,9 @@ + k1 = 0; \ + switch(mylen & 3) { \ + case 3: k1 ^= tail[2] << 16; \ +- /* fallthrough */ \ ++ fallthrough; \ + case 2: k1 ^= tail[1] << 8; \ +- /* fallthrough */ \ ++ fallthrough; \ + case 1: k1 ^= tail[0]; \ + k1 *= c1; k1 = ROTL32(k1,15); k1 *= c2; h1 ^= k1; \ + } \ +diff --git a/runtime/syscall.h b/runtime/syscall.h +index 6b4b3071a..f5b473b04 100644 +--- a/runtime/syscall.h ++++ b/runtime/syscall.h +@@ -351,23 +351,23 @@ _stp_syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, + case 0: + if (!n--) break; + *args++ = regs->bx; +- /* fallthrough */ ++ fallthrough; + case 1: + if (!n--) break; + *args++ = regs->cx; +- /* fallthrough */ ++ fallthrough; + case 2: + if (!n--) break; + *args++ = regs->dx; +- /* fallthrough */ ++ fallthrough; + case 3: + if (!n--) break; + *args++ = regs->si; +- /* fallthrough */ ++ fallthrough; + case 4: + if (!n--) break; + *args++ = regs->di; +- /* fallthrough */ ++ fallthrough; + case 5: + if (!n--) break; + *args++ = regs->bp; +@@ -375,23 +375,23 @@ _stp_syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, + case 0: + if (!n--) break; + *args++ = regs->rbx; +- /* fallthrough */ ++ fallthrough; + case 1: + if (!n--) break; + *args++ = regs->rcx; +- /* fallthrough */ ++ fallthrough; + case 2: + if (!n--) break; + *args++ = regs->rdx; +- /* fallthrough */ ++ fallthrough; + case 3: + if (!n--) break; + *args++ = regs->rsi; +- /* fallthrough */ ++ fallthrough; + case 4: + if (!n--) break; + *args++ = regs->rdi; +- /* fallthrough */ ++ fallthrough; + case 5: + if (!n--) break; + *args++ = regs->rbp; +@@ -405,23 +405,23 @@ _stp_syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, + case 0: + if (!n--) break; + *args++ = regs->di; +- /* fallthrough */ ++ fallthrough; + case 1: + if (!n--) break; + *args++ = regs->si; +- /* fallthrough */ ++ fallthrough; + case 2: + if (!n--) break; + *args++ = regs->dx; +- /* fallthrough */ ++ fallthrough; + case 3: + if (!n--) break; + *args++ = regs->r10; +- /* fallthrough */ ++ fallthrough; + case 4: + if (!n--) break; + *args++ = regs->r8; +- /* fallthrough */ ++ fallthrough; + case 5: + if (!n--) break; + *args++ = regs->r9; +@@ -429,23 +429,23 @@ _stp_syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, + case 0: + if (!n--) break; + *args++ = regs->rdi; +- /* fallthrough */ ++ fallthrough; + case 1: + if (!n--) break; + *args++ = regs->rsi; +- /* fallthrough */ ++ fallthrough; + case 2: + if (!n--) break; + *args++ = regs->rdx; +- /* fallthrough */ ++ fallthrough; + case 3: + if (!n--) break; + *args++ = regs->r10; +- /* fallthrough */ ++ fallthrough; + case 4: + if (!n--) break; + *args++ = regs->r8; +- /* fallthrough */ ++ fallthrough; + case 5: + if (!n--) break; + *args++ = regs->r9; +@@ -575,30 +575,30 @@ static inline void _stp_syscall_get_arguments(struct task_struct *task, + case 6: + if (!n--) break; + *args++ = regs->r13; +- /* fallthrough */ ++ fallthrough; + case 5: + if (!n--) break; + *args++ = regs->r15; +- /* fallthrough */ ++ fallthrough; + case 4: + if (!n--) break; + *args++ = regs->r14; +- /* fallthrough */ ++ fallthrough; + case 3: + if (!n--) break; + *args++ = regs->r10; +- /* fallthrough */ ++ fallthrough; + case 2: + if (!n--) break; + *args++ = regs->r9; +- /* fallthrough */ ++ fallthrough; + case 1: + if (!n--) break; + *args++ = regs->r11; +- /* fallthrough */ ++ fallthrough; + case 0: + if (!n--) break; +- /* fallthrough */ ++ fallthrough; + default: + BUG(); + break; +@@ -630,23 +630,23 @@ _stp_syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, + case 0: + if (!n--) break; + *args++ = regs->orig_gpr2 & mask; +- /* fallthrough */ ++ fallthrough; + case 1: + if (!n--) break; + *args++ = regs->gprs[3] & mask; +- /* fallthrough */ ++ fallthrough; + case 2: + if (!n--) break; + *args++ = regs->gprs[4] & mask; +- /* fallthrough */ ++ fallthrough; + case 3: + if (!n--) break; + *args++ = regs->gprs[5] & mask; +- /* fallthrough */ ++ fallthrough; + case 4: + if (!n--) break; + *args++ = regs->gprs[6] & mask; +- /* fallthrough */ ++ fallthrough; + case 5: + if (!n--) break; + *args++ = regs->args[0] & mask; +diff --git a/runtime/unwind.c b/runtime/unwind.c +index dba16a724..6916d2e96 100644 +--- a/runtime/unwind.c ++++ b/runtime/unwind.c +@@ -527,7 +527,7 @@ static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc, + REG_STATE.cfa.reg = value; + dbug_unwind(1, "DW_CFA_def_cfa reg=%ld\n", REG_STATE.cfa.reg); + } +- /* fallthrough */ ++ fallthrough; + case DW_CFA_def_cfa_offset: + if (REG_STATE.cfa_is_expr != 0) { + _stp_warn("Unexpected DW_CFA_def_cfa_offset\n"); +@@ -549,7 +549,7 @@ static int processCFI(const u8 *start, const u8 *end, unsigned long targetLoc, + value, DWARF_REG_MAP(value)); + REG_STATE.cfa.reg = value; + } +- /* fallthrough */ ++ fallthrough; + case DW_CFA_def_cfa_offset_sf: + if (REG_STATE.cfa_is_expr != 0) { + _stp_warn("Unexpected DW_CFA_def_cfa_offset_sf\n"); +@@ -922,7 +922,7 @@ static int compute_expr(const u8 *expr, struct unwind_frame_info *frame, + case DW_OP_bra: + if (POP == 0) + break; +- /* Fall through. */ ++ fallthrough; + case DW_OP_skip: + NEED(sizeof(u.s16)); + memcpy(&u.s16, expr, sizeof(u.s16)); +diff --git a/runtime/unwind/unwind.h b/runtime/unwind/unwind.h +index a9586a338..5c68a5f03 100644 +--- a/runtime/unwind/unwind.h ++++ b/runtime/unwind/unwind.h +@@ -154,13 +154,13 @@ static unsigned long read_ptr_sect(const u8 **pLoc, const void *end, + value = _stp_get_unaligned(ptr.p32u++); + break; + } +- /* fallthrough */ ++ fallthrough; + case DW_EH_PE_data8: + BUILD_BUG_ON(sizeof(u64) != sizeof(value)); + #else + BUILD_BUG_ON(sizeof(u32) != sizeof(value)); + #endif +- /* fallthrough */ ++ fallthrough; + case DW_EH_PE_absptr: + if (compat_task) + { +diff --git a/runtime/vsprintf.c b/runtime/vsprintf.c +index 417d9f7f3..cd31a938b 100644 +--- a/runtime/vsprintf.c ++++ b/runtime/vsprintf.c +@@ -641,7 +641,7 @@ _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) + + case 'X': + flags |= STP_LARGE; +- /* fallthru */ ++ fallthrough; + case 'x': + base = 16; + break; +@@ -649,7 +649,7 @@ _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) + case 'd': + case 'i': + flags |= STP_SIGN; +- /* fallthru */ ++ fallthrough; + case 'u': + break; + +@@ -835,7 +835,7 @@ _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) + + case 'X': + flags |= STP_LARGE; +- /* fallthru */ ++ fallthrough; + case 'x': + base = 16; + break; +@@ -843,7 +843,7 @@ _stp_vsnprintf(char *buf, size_t size, const char *fmt, va_list args) + case 'd': + case 'i': + flags |= STP_SIGN; +- /* fallthru */ ++ fallthrough; + case 'u': + break; + +diff --git a/tapset/linux/aux_syscalls.stp b/tapset/linux/aux_syscalls.stp +index ad8a89898..09fb9ff41 100644 +--- a/tapset/linux/aux_syscalls.stp ++++ b/tapset/linux/aux_syscalls.stp +@@ -156,11 +156,11 @@ sigset_from_compat(sigset_t *set, compat_sigset_t *compat) + { + switch (_NSIG_WORDS) { + case 4: set->sig[3] = compat->sig[6] | (((long)compat->sig[7]) << 32 ); +- /*fallthrough*/ ++ fallthrough; + case 3: set->sig[2] = compat->sig[4] | (((long)compat->sig[5]) << 32 ); +- /*fallthrough*/ ++ fallthrough; + case 2: set->sig[1] = compat->sig[2] | (((long)compat->sig[3]) << 32 ); +- /*fallthrough*/ ++ fallthrough; + case 1: set->sig[0] = compat->sig[0] | (((long)compat->sig[1]) << 32 ); + } + } +@@ -3627,13 +3627,13 @@ function _struct_sigaction32_u:string(uaddr:long) + { + case 4: act.sa_mask.sig[3] = act32.sa_mask.sig[6] + | (((long)act32.sa_mask.sig[7]) << 32); +- /* fallthrough */ ++ fallthrough; + case 3: act.sa_mask.sig[2] = act32.sa_mask.sig[4] + | (((long)act32.sa_mask.sig[5]) << 32); +- /* fallthrough */ ++ fallthrough; + case 2: act.sa_mask.sig[1] = act32.sa_mask.sig[2] + | (((long)act32.sa_mask.sig[3]) << 32); +- /* fallthrough */ ++ fallthrough; + case 1: act.sa_mask.sig[0] = act32.sa_mask.sig[0] + | (((long)act32.sa_mask.sig[1]) << 32); + } + +commit ea00c10704bfc64b908ef96e4b9574dadeae2b03 +Author: Frank Ch. Eigler +Date: Sun Jul 25 22:09:18 2021 -0400 + + PR28140: kernel 5.14-rc adaptation, jump_label_patch + + Linux commit ab3257042c2 makes it necessary for us to stop overriding + CONFIG_STACK_VALIDATION= (originally a workaround for a 2016 rawhide + bug). This fixes the tracepoints.stp test case. + +diff --git a/buildrun.cxx b/buildrun.cxx +index ae27ddea4..6a6725db6 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -120,7 +120,13 @@ make_any_make_cmd(systemtap_session& s, const string& dir, const string& target) + "CONFIG_DEBUG_INFO_BTF_MODULES=", + + // RHBZ1321628: suppress stack validation; expected to be temporary +- "CONFIG_STACK_VALIDATION=", ++ // "CONFIG_STACK_VALIDATION=", ++ ++ // PR28140 ... as of kernel 5.14-rc*, this is actively ++ // dangerous, because it skips the full objtool processing ++ // chain, and the resulting tracepoint call sites in the ko are ++ // not properly instrumented. See also Linux commit ++ // ab3257042c2. + }; + + // PR10280: suppress symbol versioning to restrict to exact kernel version + +commit e66f3a83b49b5c0a35074cf0f4b378e51c241a81 +Author: Frank Ch. Eigler +Date: Sun Jul 25 22:35:59 2021 -0400 + + runtime: adapt to -Werror=implicit-fallthrough=5, dyninst runtime + + The runtime/dyninst/runtime.h also needs a fallthrough macro def'n. + +diff --git a/runtime/dyninst/runtime.h b/runtime/dyninst/runtime.h +index 9e61ef50b..6f028e27d 100644 +--- a/runtime/dyninst/runtime.h ++++ b/runtime/dyninst/runtime.h +@@ -389,4 +389,20 @@ static void stp_dyninst_dtor(void) + _stp_copy_destroy(); + } + ++ ++/* A fallthrough; macro to let the runtime survive -Wimplicit-fallthrough=5 */ ++/* from */ ++#ifndef fallthrough ++#if __GNUC__ < 5 ++# define fallthrough do {} while (0) /* fallthrough */ ++#else ++#if __has_attribute(__fallthrough__) ++# define fallthrough __attribute__((__fallthrough__)) ++#else ++# define fallthrough do {} while (0) /* fallthrough */ ++#endif ++#endif ++#endif ++ ++ + #endif /* _STAPDYN_RUNTIME_H_ */ + +commit b47d03c20aeab5276b67adbe367889c7762c4a92 +Author: Frank Ch. Eigler +Date: Sun Jul 18 21:32:51 2021 -0400 + + PR28079: Adapt to kernel 5.14 task_struct.__state change + + In tapset, use @choose_defined() for old & new field names. + +diff --git a/tapset/linux/task.stp b/tapset/linux/task.stp +index b542b610e..40dc3e2e0 100644 +--- a/tapset/linux/task.stp ++++ b/tapset/linux/task.stp +@@ -186,7 +186,7 @@ function task_parent:long(task:long) + */ + function task_state:long (task:long) + { +- return @task(task)->state ++ return @choose_defined(@task(task)->state,@task(task)->__state) + } + + /** + +commit 559fd51fe90ef096c4389f90604ec808869b58a6 +Author: Frank Ch. Eigler +Date: Fri Aug 6 12:16:21 2021 -0400 + + testsuite: time-limit auxiliary child processes + + The testsuite has been observed to intermittently hang on 5.13+ + generation kernels. This is caused by some test binaries (especially + recv*.c) suffering a segv and terminating, but their forked child + process pals still hanging around (indefinitely). This patch adds an + alarm(30) to each such test, so the children will burn twice as + bright, but half as long, or something. + +diff --git a/testsuite/systemtap.syscall/connect.c b/testsuite/systemtap.syscall/connect.c +index a9350025d..f2239dd80 100644 +--- a/testsuite/systemtap.syscall/connect.c ++++ b/testsuite/systemtap.syscall/connect.c +@@ -73,7 +73,8 @@ start_server(struct sockaddr_in *sin0) + + switch (pid = fork()) { + case 0: /* child */ +- do_child(); ++ alarm(30); ++ do_child(); + break; + case -1: /* fall through */ + default: /* parent */ +diff --git a/testsuite/systemtap.syscall/futex.c b/testsuite/systemtap.syscall/futex.c +index 4740e1c82..fe740a146 100644 +--- a/testsuite/systemtap.syscall/futex.c ++++ b/testsuite/systemtap.syscall/futex.c +@@ -38,7 +38,8 @@ int main() + + pid = fork(); + if (pid == 0) { /* child */ +- do_child(); ++ alarm(30); ++ do_child(); + exit(0); + } + +diff --git a/testsuite/systemtap.syscall/process_vm.c b/testsuite/systemtap.syscall/process_vm.c +index 4c4ffe4a9..b776354ac 100644 +--- a/testsuite/systemtap.syscall/process_vm.c ++++ b/testsuite/systemtap.syscall/process_vm.c +@@ -31,7 +31,8 @@ int main() + + pid = fork(); + if (pid == 0) { /* child */ +- do_child(); ++ alarm(30); ++ do_child(); + return 0; + } + +diff --git a/testsuite/systemtap.syscall/ptrace.c b/testsuite/systemtap.syscall/ptrace.c +index 533414799..8d8418d34 100644 +--- a/testsuite/systemtap.syscall/ptrace.c ++++ b/testsuite/systemtap.syscall/ptrace.c +@@ -93,6 +93,7 @@ int main() + child_pid = fork(); + if (child_pid == 0) { + /* Child */ ++ alarm(30); + do_child(); + exit(0); + } +diff --git a/testsuite/systemtap.syscall/recv.c b/testsuite/systemtap.syscall/recv.c +index 9635b269e..b5ccf08d6 100644 +--- a/testsuite/systemtap.syscall/recv.c ++++ b/testsuite/systemtap.syscall/recv.c +@@ -76,6 +76,7 @@ start_server(struct sockaddr_in *sin0) + + switch (pid = fork()) { + case 0: /* child */ ++ alarm(30); + do_child(); + break; + case -1: /* fall through */ +diff --git a/testsuite/systemtap.syscall/recvfrom.c b/testsuite/systemtap.syscall/recvfrom.c +index eeb567c78..0b5d20c20 100644 +--- a/testsuite/systemtap.syscall/recvfrom.c ++++ b/testsuite/systemtap.syscall/recvfrom.c +@@ -77,6 +77,7 @@ start_server(struct sockaddr_in *sin0) + + switch (pid = fork()) { + case 0: /* child */ ++ alarm(30); + do_child(); + break; + case -1: /* fall through */ +diff --git a/testsuite/systemtap.syscall/recvmmsg.c b/testsuite/systemtap.syscall/recvmmsg.c +index 0b925d0d7..edf12e388 100644 +--- a/testsuite/systemtap.syscall/recvmmsg.c ++++ b/testsuite/systemtap.syscall/recvmmsg.c +@@ -123,6 +123,7 @@ start_server(struct sockaddr_in *ssin, struct sockaddr_un *ssun) + + switch (pid = fork()) { + case 0: /* child */ ++ alarm(30); + do_child(); + break; + case -1: /* fall through */ +diff --git a/testsuite/systemtap.syscall/recvmsg.c b/testsuite/systemtap.syscall/recvmsg.c +index 1d32e7482..7f72ae573 100644 +--- a/testsuite/systemtap.syscall/recvmsg.c ++++ b/testsuite/systemtap.syscall/recvmsg.c +@@ -122,6 +122,7 @@ start_server(struct sockaddr_in *ssin, struct sockaddr_un *ssun) + + switch (pid = fork()) { + case 0: /* child */ ++ alarm(30); + do_child(); + break; + case -1: /* fall through */ +diff --git a/testsuite/systemtap.syscall/send.c b/testsuite/systemtap.syscall/send.c +index 12bcf12a2..970f9347c 100644 +--- a/testsuite/systemtap.syscall/send.c ++++ b/testsuite/systemtap.syscall/send.c +@@ -75,6 +75,7 @@ start_server(struct sockaddr_in *sin0) + + switch (pid = fork()) { + case 0: /* child */ ++ alarm(30); + do_child(); + break; + case -1: /* fall through */ +diff --git a/testsuite/systemtap.syscall/sendmmsg.c b/testsuite/systemtap.syscall/sendmmsg.c +index 3b0a74959..95ce65470 100644 +--- a/testsuite/systemtap.syscall/sendmmsg.c ++++ b/testsuite/systemtap.syscall/sendmmsg.c +@@ -87,6 +87,7 @@ start_server(struct sockaddr_in *sin0) + + switch (pid = fork()) { + case 0: /* child */ ++ alarm(30); + do_child(); + break; + case -1: /* fall through */ +diff --git a/testsuite/systemtap.syscall/sendmsg.c b/testsuite/systemtap.syscall/sendmsg.c +index 6bcb4e358..db07eb7b4 100644 +--- a/testsuite/systemtap.syscall/sendmsg.c ++++ b/testsuite/systemtap.syscall/sendmsg.c +@@ -75,6 +75,7 @@ start_server(struct sockaddr_in *sin0) + + switch (pid = fork()) { + case 0: /* child */ ++ alarm(30); + do_child(); + break; + case -1: /* fall through */ +diff --git a/testsuite/systemtap.syscall/sendto.c b/testsuite/systemtap.syscall/sendto.c +index 44a8a5c0a..c3441bc22 100644 +--- a/testsuite/systemtap.syscall/sendto.c ++++ b/testsuite/systemtap.syscall/sendto.c +@@ -75,6 +75,7 @@ start_server(struct sockaddr_in *sin0) + + switch (pid = fork()) { + case 0: /* child */ ++ alarm(30); + do_child(); + break; + case -1: /* fall through */ + +commit 0581a6560a4922a92cef70348303012682a8a436 +Author: Junlong Li +Date: Fri Aug 6 14:24:12 2021 -0400 + + PR28184: Adapt to kernel rename __fcheck_files to files_lookup_fd_raw + + The 5.11 kernel renamed __fcheck_files to files_lookup_fd_raw + +diff --git a/runtime/linux/autoconf-files_lookup_fd_raw.c b/runtime/linux/autoconf-files_lookup_fd_raw.c +new file mode 100644 +index 000000000..9e98aa064 +--- /dev/null ++++ b/runtime/linux/autoconf-files_lookup_fd_raw.c +@@ -0,0 +1,9 @@ ++#include ++#include ++ ++void ++foo(void) ++{ ++ struct file *filp = files_lookup_fd_raw(NULL, 0); ++ (void) filp; ++} + +commit f2c1477678ecc2b03b55e21c31747004e2c78717 +Author: Junlong Li +Date: Fri Aug 6 17:41:53 2021 -0400 + + PR28184: Adapt to kernel rename __fcheck_files to files_lookup_fd_raw + + The 5.11 kernel renamed __fcheck_files to files_lookup_fd_raw + +diff --git a/buildrun.cxx b/buildrun.cxx +index 6a6725db6..a7090c448 100644 +--- a/buildrun.cxx ++++ b/buildrun.cxx +@@ -529,6 +529,8 @@ compile_pass (systemtap_session& s) + output_autoconf(s, o, cs, "autoconf-lockdown-kernel.c", "STAPCONF_LOCKDOWN_KERNEL", NULL); + output_autoconf(s, o, cs, "autoconf-hlist_add_tail_rcu.c", + "STAPCONF_HLIST_ADD_TAIL_RCU", NULL); ++ output_autoconf(s, o, cs, "autoconf-files_lookup_fd_raw.c", ++ "STAPCONF_FILES_LOOKUP_FD_RAW", NULL); + output_autoconf(s, o, cs, "autoconf-task-state.c", "STAPCONF_TASK_STATE", NULL); + + // used by runtime/linux/netfilter.c +diff --git a/tapset/linux/task.stp b/tapset/linux/task.stp +index 40dc3e2e0..d47462513 100644 +--- a/tapset/linux/task.stp ++++ b/tapset/linux/task.stp +@@ -706,7 +706,11 @@ function task_fd_lookup:long(task:long, fd:long) + (void)kderef_buffer(NULL, files, sizeof(struct files_struct)); + + spin_lock(&files->file_lock); ++#ifdef STAPCONF_FILES_LOOKUP_FD_RAW ++ file = files_lookup_fd_raw(files, fd); ++#else + file = fcheck_files(files, fd); ++#endif + spin_unlock(&files->file_lock); + } + +commit e6a1b008b822ed211b8f9c15fda565f8d51e512d +Author: Stan Cox +Date: Thu Aug 26 09:46:20 2021 -0400 + + Shorten function names that will exceed the kernel's objtool limit of 128 + + translate.cxx (c_unparser::emit_global_init_type,emit_function) Shorten + (c_unparser::c_funcname) Add funcname_shortened parm, shorten + name if length limit exceeded + + testsuite/systemtap.base/func_definition.{exp,stp} Add shorten funcname test. + +diff --git a/testsuite/systemtap.base/func_definition.exp b/testsuite/systemtap.base/func_definition.exp +index 6598aeea5..0aeab4c70 100644 +--- a/testsuite/systemtap.base/func_definition.exp ++++ b/testsuite/systemtap.base/func_definition.exp +@@ -5,9 +5,25 @@ if {![installtest_p]} { untested "$test"; return } + + foreach runtime [get_runtime_list] { + if {$runtime != ""} { +- stap_run $test no_load (${all_pass_string}){5} \ ++ stap_run $test no_load (${all_pass_string}){6} \ + --runtime=$runtime $srcdir/$subdir/$test.stp + } else { +- stap_run $test no_load (${all_pass_string}){5} $srcdir/$subdir/$test.stp ++ stap_run $test no_load (${all_pass_string}){6} $srcdir/$subdir/$test.stp + } + } ++ ++set ok 0 ++set cmd "bash -c {$env(SYSTEMTAP_PATH)/stap --runtime=$runtime -v -v -p3 $srcdir/$subdir/$test.stp |& grep -A 1 'function_names_over_128'}" ++eval spawn $cmd ++expect { ++ -timeout 180 ++ # Match shortened function declaration, definition, and reference ++ -re { function_[0-9] } { incr ok; exp_continue } ++ eof { } ++} ++ ++if {$ok == 3} { ++ pass "$test function name shorten" ++} else { ++ fail "$test function name shorten ($ok!=3)" ++} +diff --git a/testsuite/systemtap.base/func_definition.stp b/testsuite/systemtap.base/func_definition.stp +index eaa8d94c5..7ed938eb9 100644 +--- a/testsuite/systemtap.base/func_definition.stp ++++ b/testsuite/systemtap.base/func_definition.stp +@@ -39,6 +39,11 @@ function f5() + println("systemtap test success") + } + ++function function_names_over_128_characters_exceed_MAX_NAME_LEN_in_linux_objtool_which_is_invoked_by_kbuild_and_are_therefore_shortened() ++{ ++ return 2021 ++} ++ + probe end { + println("systemtap ending probe") + +@@ -57,4 +62,7 @@ probe end { + printf("systemtap test failure - return_value of f4:%d != 2015\n", f4()) + + f5() ++ ++ if (function_names_over_128_characters_exceed_MAX_NAME_LEN_in_linux_objtool_which_is_invoked_by_kbuild_and_are_therefore_shortened() == 2021) ++ println("systemtap test success") + } +diff --git a/translate.cxx b/translate.cxx +index 59fa2e4a0..beb7d7acd 100644 +--- a/translate.cxx ++++ b/translate.cxx +@@ -58,6 +58,9 @@ extern "C" { + #define STAP_T_06 _("\"empty aggregate\";") + #define STAP_T_07 _("\"histogram index out of range\";") + ++// This matches MAX_NAME_LEN in linux objtool/elf.c used by kbuild ++#define MAX_NAME_LEN 128 ++ + using namespace std; + + class var; +@@ -183,6 +186,7 @@ struct c_unparser: public unparser, public visitor + virtual string c_localname (const string& e, bool mangle_oldstyle = false); + virtual string c_globalname (const string &e); + virtual string c_funcname (const string &e); ++ virtual string c_funcname (const string &e, bool &funcname_shortened); + + string c_arg_define (const string& e); + string c_arg_undef (const string& e); +@@ -1755,7 +1759,11 @@ c_unparser::emit_global_init_type (vardecl *v) + void + c_unparser::emit_functionsig (functiondecl* v) + { +- o->newline() << "static void " << c_funcname(v->name) ++ bool funcname_shortened; ++ string funcname = c_funcname (v->name, funcname_shortened); ++ if (funcname_shortened) ++ o->newline() << "/* " << v->name << " */"; ++ o->newline() << "static void " << funcname + << " (struct context * __restrict__ c);"; + } + +@@ -2520,7 +2528,11 @@ c_tmpcounter::emit_function (functiondecl* fd) + // indent the dummy output as if we were already in a block + this->o->indent (1); + +- o->newline() << "struct " << c_funcname (fd->name) << "_locals {"; ++ bool funcname_shortened; ++ string funcname = c_funcname (fd->name, funcname_shortened); ++ if (funcname_shortened) ++ o->newline() << "/* " << fd->name << " */"; ++ o->newline() << "struct " << funcname << "_locals {"; + o->indent(1); + + for (unsigned j=0; jlocals.size(); j++) +@@ -2615,7 +2627,11 @@ c_unparser::emit_function (functiondecl* v) + this->action_counter = 0; + this->already_checked_action_count = false; + +- o->newline() << "static void " << c_funcname (v->name) ++ bool funcname_shortened; ++ string funcname = c_funcname (v->name, funcname_shortened); ++ if (funcname_shortened) ++ o->newline() << "/* " << v->name << " */"; ++ o->newline() << "static void " << funcname + << " (struct context* __restrict__ c) {"; + o->indent(1); + +@@ -3385,11 +3401,41 @@ c_unparser::c_globalname (const string& e) + + + string +-c_unparser::c_funcname (const string& e) ++c_unparser::c_funcname (const string& e, bool& funcname_shortened) + { ++ const string function_prefix = "function_"; + // XXX uncomment to test custom mangling: +- // return "function_" + e + "_" + lex_cast(do_hash(e.c_str())); +- return "function_" + e; ++ // return function_prefix + e + "_" + lex_cast(do_hash(e.c_str())); ++ ++ // The kernel objtool used by kbuild has a hardcoded function length limit ++ if (e.length() > MAX_NAME_LEN - function_prefix.length()) ++ { ++ int function_index = 0; ++ for (map::iterator it = session->functions.begin(); ++ it != session->functions.end(); it++) ++ { ++ if (it->first == e) ++ { ++ funcname_shortened = true; ++ return function_prefix + to_string(function_index); ++ } ++ function_index += 1; ++ } ++ throw SEMANTIC_ERROR (_("unresolved symbol: ") + e); // should not happen ++ } ++ else ++ { ++ funcname_shortened = false; ++ return function_prefix + e; ++ } ++} ++ ++ ++string ++c_unparser::c_funcname (const string& e) ++{ ++ bool funcname_shortened; ++ return c_funcname (e, funcname_shortened); + } + + + +commit 3bca174698360389fbf2c28e8eaaacc0b7cbbdb0 +Author: Stan Cox +Date: Mon Aug 30 16:53:51 2021 -0400 + + Use lex_cast instead of to_string when shortening function names. + +diff --git a/testsuite/systemtap.base/func_definition.exp b/testsuite/systemtap.base/func_definition.exp +index 0aeab4c70..721900f98 100644 +--- a/testsuite/systemtap.base/func_definition.exp ++++ b/testsuite/systemtap.base/func_definition.exp +@@ -13,7 +13,7 @@ foreach runtime [get_runtime_list] { + } + + set ok 0 +-set cmd "bash -c {$env(SYSTEMTAP_PATH)/stap --runtime=$runtime -v -v -p3 $srcdir/$subdir/$test.stp |& grep -A 1 'function_names_over_128'}" ++set cmd "bash -c {$env(SYSTEMTAP_PATH)/stap -v -v -p3 $srcdir/$subdir/$test.stp |& grep -A 1 'function_names_over_128'}" + eval spawn $cmd + expect { + -timeout 180 +diff --git a/translate.cxx b/translate.cxx +index beb7d7acd..312fd0801 100644 +--- a/translate.cxx ++++ b/translate.cxx +@@ -3410,14 +3410,14 @@ c_unparser::c_funcname (const string& e, bool& funcname_shortened) + // The kernel objtool used by kbuild has a hardcoded function length limit + if (e.length() > MAX_NAME_LEN - function_prefix.length()) + { +- int function_index = 0; ++ long function_index = 0; + for (map::iterator it = session->functions.begin(); + it != session->functions.end(); it++) + { + if (it->first == e) + { + funcname_shortened = true; +- return function_prefix + to_string(function_index); ++ return function_prefix + lex_cast (function_index); + } + function_index += 1; + } +commit 4996a29c6b5dd891aeaf31df1a50058bd785621b +Author: Frank Ch. Eigler +Date: Thu Sep 9 21:22:31 2021 -0400 + + tapset: start adopting kernel netif_* tracepoints in netdev.* tapset + + Start with netdev.receive. + +diff --git a/tapset/linux/networking.stp b/tapset/linux/networking.stp +index 0b52cbc50..bf9cabfd5 100644 +--- a/tapset/linux/networking.stp ++++ b/tapset/linux/networking.stp +@@ -117,7 +117,8 @@ function get_netdev_name:string (addr:long) { + /// + // Main device receive routine, be called when packet arrives on network device + probe netdev.receive +- = kernel.function("netif_receive_skb_internal") !, ++ = kernel.trace("netif_receive_skb") !, ++ kernel.function("netif_receive_skb_internal") !, + kernel.function("netif_receive_skb") + { + try { dev_name = get_netdev_name($skb->dev) } catch { } diff --git a/SPECS/systemtap.spec b/SPECS/systemtap.spec new file mode 100644 index 0000000..0c6d205 --- /dev/null +++ b/SPECS/systemtap.spec @@ -0,0 +1,1478 @@ +%{!?with_sqlite: %global with_sqlite 0%{?fedora} >= 17 || 0%{?rhel} >= 7} +# prefer prebuilt docs +%{!?with_docs: %global with_docs 0} +%{!?with_htmldocs: %global with_htmldocs 0} +%{!?with_monitor: %global with_monitor 1} +# crash is not available +%ifarch ppc ppc64 %{sparc} %{mips} +%{!?with_crash: %global with_crash 0} +%else +%{!?with_crash: %global with_crash 1} +%endif +%{!?with_rpm: %global with_rpm 1} +%{!?elfutils_version: %global elfutils_version 0.179} +%{!?pie_supported: %global pie_supported 1} +%{!?with_boost: %global with_boost 0} +%ifarch %{ix86} x86_64 ppc ppc64 ppc64le aarch64 +%{!?with_dyninst: %global with_dyninst 0%{?fedora} >= 18 || 0%{?rhel} >= 7} +%else +%{!?with_dyninst: %global with_dyninst 0} +%endif +%{!?with_bpf: %global with_bpf 0%{?fedora} >= 22 || 0%{?rhel} >= 8} +%{!?with_systemd: %global with_systemd 0%{?fedora} >= 19 || 0%{?rhel} >= 7} +%{!?with_emacsvim: %global with_emacsvim 0%{?fedora} >= 19 || 0%{?rhel} >= 7} +%{!?with_java: %global with_java 0%{?fedora} >= 19 || 0%{?rhel} >= 7} +%{!?with_debuginfod: %global with_debuginfod 0%{?fedora} >= 25 || 0%{?rhel} >= 7} +%{!?with_virthost: %global with_virthost 0%{?fedora} >= 19 || 0%{?rhel} >= 7} +%{!?with_virtguest: %global with_virtguest 1} +%{!?with_dracut: %global with_dracut 0%{?fedora} >= 19 || 0%{?rhel} >= 6} +%ifarch x86_64 +%{!?with_mokutil: %global with_mokutil 0%{?fedora} >= 18 || 0%{?rhel} >= 7} +%{!?with_openssl: %global with_openssl 0%{?fedora} >= 18 || 0%{?rhel} >= 7} +%else +%{!?with_mokutil: %global with_mokutil 0} +%{!?with_openssl: %global with_openssl 0} +%endif +%{!?with_pyparsing: %global with_pyparsing 0%{?fedora} >= 18 || 0%{?rhel} >= 7} +%{!?with_python3: %global with_python3 0%{?fedora} >= 23 || 0%{?rhel} > 7} +%{!?with_python2_probes: %global with_python2_probes (0%{?fedora} <= 28 && 0%{?rhel} <= 7)} +%{!?with_python3_probes: %global with_python3_probes (0%{?fedora} >= 23 || 0%{?rhel} > 7)} +%{!?with_httpd: %global with_httpd 0} +%{!?with_specific_python: %global with_specific_python 0%{?fedora} >= 31} + +# Virt is supported on these arches, even on el7, but it's not in core EL7 +%if 0%{?rhel} <= 7 +%ifarch ppc64le aarch64 +%global with_virthost 0 +%endif +%endif + +%if 0%{?fedora} >= 18 || 0%{?rhel} >= 6 + %define initdir %{_initddir} +%else + # RHEL5 doesn't know _initddir + %define initdir %{_initrddir} +%endif + +%if %{with_virtguest} + %if 0%{?fedora} >= 18 || 0%{?rhel} >= 7 + %define udevrulesdir /usr/lib/udev/rules.d + %else + %if 0%{?rhel} >= 6 + %define udevrulesdir /lib/udev/rules.d + %else + # RHEL5 + %define udevrulesdir /etc/udev/rules.d + %endif + %endif +%endif + +%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7 + %define dracutstap %{_prefix}/lib/dracut/modules.d/99stap +%else + %define dracutstap %{_prefix}/share/dracut/modules.d/99stap +%endif + +%if 0%{?rhel} == 6 || 0%{?rhel} == 7 + %define dracutbindir /sbin +%else + %define dracutbindir %{_bindir} +%endif + +%if 0%{?rhel} == 6 + %{!?_rpmmacrodir: %define _rpmmacrodir /etc/rpm/} +%else + %{!?_rpmmacrodir: %define _rpmmacrodir %{_rpmconfigdir}/macros.d} +%endif + +# To avoid testsuite/*/*.stp has shebang which doesn't start with '/' +%define __brp_mangle_shebangs_exclude_from .stp$ + +Name: systemtap +Version: 4.5 +Release: 8%{?release_override}%{?dist} +# for version, see also configure.ac + + +# Packaging abstract: +# +# systemtap empty req:-client req:-devel +# systemtap-server /usr/bin/stap-server*, req:-devel +# systemtap-devel /usr/bin/stap, runtime, tapset, req:kernel-devel +# systemtap-runtime /usr/bin/staprun, /usr/bin/stapsh, /usr/bin/stapdyn +# systemtap-client /usr/bin/stap, samples, docs, tapset(bonus), req:-runtime +# systemtap-initscript /etc/init.d/systemtap, dracut module, req:systemtap +# systemtap-sdt-devel /usr/include/sys/sdt.h /usr/bin/dtrace +# systemtap-testsuite /usr/share/systemtap/testsuite*, req:systemtap, req:sdt-devel +# systemtap-runtime-java libHelperSDT.so, HelperSDT.jar, stapbm, req:-runtime +# systemtap-runtime-virthost /usr/bin/stapvirt, req:libvirt req:libxml2 +# systemtap-runtime-virtguest udev rules, init scripts/systemd service, req:-runtime +# systemtap-runtime-python2 HelperSDT python2 module, req:-runtime +# systemtap-runtime-python3 HelperSDT python3 module, req:-runtime +# +# Typical scenarios: +# +# stap-client: systemtap-client +# stap-server: systemtap-server +# local user: systemtap +# +# Unusual scenarios: +# +# intermediary stap-client for --remote: systemtap-client (-runtime unused) +# intermediary stap-server for --use-server: systemtap-server (-devel unused) + +Summary: Programmable system-wide instrumentation system +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Source: ftp://sourceware.org/pub/systemtap/releases/systemtap-%{version}.tar.gz + +Patch1: rhbz1972803.patch +Patch2: rhbz1972828.patch +Patch3: rhbz1972805.patch +Patch4: rhbz1982908.patch +Patch5: rhbz1985124.patch + +# Build* +BuildRequires: make +BuildRequires: gcc-c++ +BuildRequires: cpio +BuildRequires: gettext-devel +BuildRequires: pkgconfig(nss) +BuildRequires: pkgconfig(avahi-client) +%if %{with_debuginfod} +BuildRequires: pkgconfig(libdebuginfod) +%endif +%if %{with_dyninst} +BuildRequires: dyninst-devel >= 10.0 +BuildRequires: pkgconfig(libselinux) +%endif +%if %{with_sqlite} +BuildRequires: sqlite-devel > 3.7 +%endif +%if %{with_monitor} +BuildRequires: pkgconfig(json-c) +BuildRequires: pkgconfig(ncurses) +%endif +%if %{with_systemd} +BuildRequires: systemd +%endif +# Needed for libstd++ < 4.0, without +%if %{with_boost} +BuildRequires: boost-devel +%endif +%if %{with_crash} +BuildRequires: crash-devel zlib-devel +%endif +%if %{with_rpm} +BuildRequires: rpm-devel +%endif +BuildRequires: elfutils-devel >= %{elfutils_version} +%if %{with_docs} +BuildRequires: /usr/bin/latex /usr/bin/dvips /usr/bin/ps2pdf +%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7 +BuildRequires: tex(fullpage.sty) tex(fancybox.sty) tex(bchr7t.tfm) tex(graphicx.sty) +%endif +%if %{with_htmldocs} +# On F10, xmlto's pdf support was broken off into a sub-package, +# called 'xmlto-tex'. To avoid a specific F10 BuildReq, we'll do a +# file-based buildreq on '/usr/share/xmlto/format/fo/pdf'. +BuildRequires: xmlto /usr/share/xmlto/format/fo/pdf +%endif +%endif +%if %{with_emacsvim} +BuildRequires: emacs +%endif +%if %{with_java} +BuildRequires: java-devel +%endif +%if %{with_virthost} +# BuildRequires: libvirt-devel >= 1.0.2 +BuildRequires: pkgconfig(libvirt) +BuildRequires: pkgconfig(libxml-2.0) +%endif +BuildRequires: readline-devel +%if 0%{?rhel} <= 5 +BuildRequires: pkgconfig(ncurses) +%endif +%if %{with_python2_probes} +BuildRequires: python2-devel +%if 0%{?fedora} >= 1 +BuildRequires: python2-setuptools +%else +BuildRequires: python-setuptools +%endif +%endif +%if %{with_python3_probes} +BuildRequires: python3-devel +BuildRequires: python3-setuptools +%endif +%if %{with_specific_python} +BuildRequires: /usr/bin/pathfix.py +%endif + +%if %{with_httpd} +BuildRequires: libmicrohttpd-devel +BuildRequires: libuuid-devel +%endif + +# Install requirements +Requires: systemtap-client = %{version}-%{release} +Requires: systemtap-devel = %{version}-%{release} + +%description +SystemTap is an instrumentation system for systems running Linux. +Developers can write instrumentation scripts to collect data on +the operation of the system. The base systemtap package contains/requires +the components needed to locally develop and execute systemtap scripts. + +# ------------------------------------------------------------------------ + +%package server +Summary: Instrumentation System Server +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires: systemtap-devel = %{version}-%{release} +Conflicts: systemtap-devel < %{version}-%{release} +Conflicts: systemtap-runtime < %{version}-%{release} +Conflicts: systemtap-client < %{version}-%{release} +Requires: nss coreutils +Requires: zip unzip +Requires(pre): shadow-utils +BuildRequires: nss-devel avahi-devel +%if %{with_openssl} +Requires: openssl +%endif +%if %{with_systemd} +Requires: systemd +%else +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts +Requires(postun): initscripts +%endif + +%description server +This is the remote script compilation server component of systemtap. +It announces itself to nearby clients with avahi (if available), and +compiles systemtap scripts to kernel objects on their demand. + + +%package devel +Summary: Programmable system-wide instrumentation system - development headers, tools +License: GPLv2+ +URL: http://sourceware.org/systemtap/ + +%if 0%{?rhel} >= 8 || 0%{?fedora} >= 20 +Recommends: (kernel-debug-devel if kernel-debug) +Recommends: (kernel-devel if kernel) +%else +Requires: kernel-devel-uname-r +%endif + +Requires: gcc make +# for compiling --runtime=dyninst sripts, need elfutils headers, bz1930973 +Requires: elfutils-devel >= %{elfutils_version} + +Conflicts: systemtap-client < %{version}-%{release} +Conflicts: systemtap-server < %{version}-%{release} +Conflicts: systemtap-runtime < %{version}-%{release} +# Suggest: kernel-debuginfo + +%description devel +This package contains the components needed to compile a systemtap +script from source form into executable (.ko) forms. It may be +installed on a self-contained developer workstation (along with the +systemtap-client and systemtap-runtime packages), or on a dedicated +remote server (alongside the systemtap-server package). It includes +a copy of the standard tapset library and the runtime library C files. + + +%package runtime +Summary: Programmable system-wide instrumentation system - runtime +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires(pre): shadow-utils +Conflicts: systemtap-devel < %{version}-%{release} +Conflicts: systemtap-server < %{version}-%{release} +Conflicts: systemtap-client < %{version}-%{release} + +%description runtime +SystemTap runtime contains the components needed to execute +a systemtap script that was already compiled into a module +using a local or remote systemtap-devel installation. + + +%package client +Summary: Programmable system-wide instrumentation system - client +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires: zip unzip +Requires: systemtap-runtime = %{version}-%{release} +Requires: coreutils grep sed unzip zip +Requires: openssh-clients +Conflicts: systemtap-devel < %{version}-%{release} +Conflicts: systemtap-server < %{version}-%{release} +Conflicts: systemtap-runtime < %{version}-%{release} +%if %{with_mokutil} +Requires: mokutil +%endif + +%description client +This package contains/requires the components needed to develop +systemtap scripts, and compile them using a local systemtap-devel +or a remote systemtap-server installation, then run them using a +local or remote systemtap-runtime. It includes script samples and +documentation, and a copy of the tapset library for reference. + + +%package initscript +Summary: Systemtap Initscripts +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires: systemtap = %{version}-%{release} +%if %{with_systemd} +Requires: systemd +%else +Requires(post): chkconfig +Requires(preun): chkconfig +Requires(preun): initscripts +Requires(postun): initscripts +%endif + +%description initscript +This package includes a SysVinit script to launch selected systemtap +scripts at system startup, along with a dracut module for early +boot-time probing if supported. + + +%package sdt-devel +Summary: Static probe support tools +License: GPLv2+ and Public Domain +URL: http://sourceware.org/systemtap/ +%if %{with_pyparsing} +%if %{with_python3} +Requires: python3-pyparsing +%else +%if 0%{?rhel} >= 7 +Requires: pyparsing +%else +Requires: python2-pyparsing +%endif +%endif +%endif + +%description sdt-devel +This package includes the header file used for static +instrumentation compiled into userspace programs and libraries, along +with the optional dtrace-compatibility preprocessor to process related +.d files into tracing-macro-laden .h headers. + + +%package testsuite +Summary: Instrumentation System Testsuite +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires: systemtap = %{version}-%{release} +Requires: systemtap-sdt-devel = %{version}-%{release} +Requires: systemtap-server = %{version}-%{release} +Requires: dejagnu which elfutils grep nc +%if %{with_debuginfod} +Requires: elfutils-debuginfod +%endif +# work around fedora ci gating kvetching about i686<->x86-64 conflicts +%ifarch x86_64 +Conflicts: systemtap-testsuite = %{version}-%{release}.i686 +%endif +%ifarch i686 +Conflicts: systemtap-testsuite = %{version}-%{release}.x86_64 +%endif +Requires: gcc gcc-c++ make glibc-devel +# testsuite/systemtap.base/ptrace.exp needs strace +Requires: strace +# testsuite/systemtap.base/ipaddr.exp needs nc. Unfortunately, the rpm +# that provides nc has changed over time (from 'nc' to +# 'nmap-ncat'). So, we'll do a file-based require. +Requires: /usr/bin/nc +%ifnarch ia64 ppc64le aarch64 +%if 0%{?fedora} >= 21 || 0%{?rhel} >= 8 +# no prelink +%else +Requires: prelink +%endif +%endif +# testsuite/systemtap.server/client.exp needs avahi +Requires: avahi +%if %{with_crash} +# testsuite/systemtap.base/crash.exp needs crash +Requires: crash +%endif +%if %{with_java} +Requires: systemtap-runtime-java = %{version}-%{release} +%endif +%if %{with_python2_probes} +Requires: systemtap-runtime-python2 = %{version}-%{release} +%endif +%if %{with_python3_probes} +Requires: systemtap-runtime-python3 = %{version}-%{release} +%endif +%ifarch x86_64 +%if 0%{?rhel} >= 8 || 0%{?fedora} >= 20 +# fweimer, personal correspondence +Recommends: glibc-devel(x86-32) +%else +Requires: /usr/lib/libc.so +%endif +# ... and /usr/lib/libgcc_s.so.* +# ... and /usr/lib/libstdc++.so.* +%endif +%if 0%{?fedora} >= 18 +Requires: stress +%endif +# The following "meta" files for the systemtap examples run "perf": +# testsuite/systemtap.examples/hw_watch_addr.meta +# testsuite/systemtap.examples/memory/hw_watch_sym.meta +Requires: perf + +%description testsuite +This package includes the dejagnu-based systemtap stress self-testing +suite. This may be used by system administrators to thoroughly check +systemtap on the current system. + + +%if %{with_java} +%package runtime-java +Summary: Systemtap Java Runtime Support +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires: systemtap-runtime = %{version}-%{release} +# work around fedora ci gating kvetching about i686<->x86-64 conflicts +%ifarch x86_64 +Conflicts: systemtap-runtime = %{version}-%{release}.i686 +%endif +%ifarch i686 +Conflicts: systemtap-runtime = %{version}-%{release}.x86_64 +%endif +Requires: byteman > 2.0 +Requires: iproute +Requires: java-devel + +%description runtime-java +This package includes support files needed to run systemtap scripts +that probe Java processes running on the OpenJDK runtimes using Byteman. +%endif + +%if %{with_python2_probes} +%package runtime-python2 +Summary: Systemtap Python 2 Runtime Support +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires: systemtap-runtime = %{version}-%{release} + +%description runtime-python2 +This package includes support files needed to run systemtap scripts +that probe python 2 processes. +%endif + +%if %{with_python3_probes} +%package runtime-python3 +Summary: Systemtap Python 3 Runtime Support +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires: systemtap-runtime = %{version}-%{release} + +%if ! (%{with_python2_probes}) +# Provide an clean upgrade path when the python2 package is removed +Obsoletes: %{name}-runtime-python2 < %{version}-%{release} +%endif + +%description runtime-python3 +This package includes support files needed to run systemtap scripts +that probe python 3 processes. +%endif + +%if %{with_python3} +%package exporter +Summary: Systemtap-prometheus interoperation mechanism +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires: systemtap-runtime = %{version}-%{release} + +%description exporter +This package includes files for a systemd service that manages +systemtap sessions and relays prometheus metrics from the sessions +to remote requesters on demand. +%endif + +%if %{with_virthost} +%package runtime-virthost +Summary: Systemtap Cross-VM Instrumentation - host +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires: libvirt >= 1.0.2 +Requires: libxml2 + +%description runtime-virthost +This package includes the components required to run systemtap scripts +inside a libvirt-managed domain from the host without using a network +connection. +%endif + +%if %{with_virtguest} +%package runtime-virtguest +Summary: Systemtap Cross-VM Instrumentation - guest +License: GPLv2+ +URL: http://sourceware.org/systemtap/ +Requires: systemtap-runtime = %{version}-%{release} +%if %{with_systemd} +Requires(post): findutils coreutils +Requires(preun): grep coreutils +Requires(postun): grep coreutils +%else +Requires(post): chkconfig initscripts +Requires(preun): chkconfig initscripts +Requires(postun): initscripts +%endif + +%description runtime-virtguest +This package installs the services necessary on a virtual machine for a +systemtap-runtime-virthost machine to execute systemtap scripts. +%endif + +# ------------------------------------------------------------------------ + +%prep +%setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 + +%build + +# Enable/disable the dyninst pure-userspace backend +%if %{with_dyninst} +%global dyninst_config --with-dyninst +%else +%global dyninst_config --without-dyninst +%endif + +# Enable/disable the sqlite coverage testing support +%if %{with_sqlite} +%global sqlite_config --enable-sqlite +%else +%global sqlite_config --disable-sqlite +%endif + +%if %{with_debuginfod} +%global debuginfod_config --with-debuginfod +%else +%global debuginfod_config --without-debuginfod +%endif + + +# Enable/disable the crash extension +%if %{with_crash} +%global crash_config --enable-crash +%else +%global crash_config --disable-crash +%endif + +# Enable/disable the code to find and suggest needed rpms +%if %{with_rpm} +%global rpm_config --with-rpm +%else +%global rpm_config --without-rpm +%endif + +%if %{with_docs} +%if %{with_htmldocs} +%global docs_config --enable-docs --enable-htmldocs +%else +%global docs_config --enable-docs --disable-htmldocs +%endif +%else +%global docs_config --enable-docs=prebuilt +%endif + +# Enable pie as configure defaults to disabling it +%if %{pie_supported} +%global pie_config --enable-pie +%else +%global pie_config --disable-pie +%endif + + +%if %{with_java} +%global java_config --with-java=%{_jvmdir}/java +%else +%global java_config --without-java +%endif + +%if %{with_python3} +%global python3_config --with-python3 +%else +%global python3_config --without-python3 +%endif +%if %{with_python2_probes} +%global python2_probes_config --with-python2-probes +%else +%global python2_probes_config --without-python2-probes +%endif +%if %{with_python3_probes} +%global python3_probes_config --with-python3-probes +%else +%global python3_probes_config --without-python3-probes +%endif + +%if %{with_virthost} +%global virt_config --enable-virt +%else +%global virt_config --disable-virt +%endif + +%if %{with_dracut} +%global dracut_config --with-dracutstap=%{dracutstap} --with-dracutbindir=%{dracutbindir} +%else +%global dracut_config %{nil} +%endif + +%if %{with_httpd} +%global httpd_config --enable-httpd +%else +%global httpd_config --disable-httpd +%endif + +%if %{with_bpf} +%global bpf_config --with-bpf +%else +%global bpf_config --without-bpf +%endif + +# We don't ship compileworthy python code, just oddball samples +%global py_auto_byte_compile 0 + +%configure %{dyninst_config} %{sqlite_config} %{crash_config} %{docs_config} %{pie_config} %{rpm_config} %{java_config} %{virt_config} %{dracut_config} %{python3_config} %{python2_probes_config} %{python3_probes_config} %{httpd_config} %{bpf_config} %{debuginfod_config} --disable-silent-rules --with-extra-version="rpm %{version}-%{release}" +make %{?_smp_mflags} + + +%install +make DESTDIR=$RPM_BUILD_ROOT install +%find_lang %{name} +for dir in $(ls -1d $RPM_BUILD_ROOT%{_mandir}/{??,??_??}) ; do + dir=$(echo $dir | sed -e "s|^$RPM_BUILD_ROOT||") + lang=$(basename $dir) + echo "%%lang($lang) $dir/man*/*" >> %{name}.lang +done + +ln -s %{_datadir}/systemtap/examples + +# Fix paths in the example scripts. +find $RPM_BUILD_ROOT%{_datadir}/systemtap/examples -type f -name '*.stp' -print0 | xargs -0 sed -i -r -e '1s@^#!.+stap@#!%{_bindir}/stap@' + +# To make rpmlint happy, remove any .gitignore files in the testsuite. +find testsuite -type f -name '.gitignore' -print0 | xargs -0 rm -f + +# Because "make install" may install staprun with whatever mode, the +# post-processing programs rpmbuild runs won't be able to read it. +# So, we change permissions so that they can read it. We'll set the +# permissions back to 04110 in the %files section below. +chmod 755 $RPM_BUILD_ROOT%{_bindir}/staprun + +#install the useful stap-prep script +install -c -m 755 stap-prep $RPM_BUILD_ROOT%{_bindir}/stap-prep + +# Copy over the testsuite +cp -rp testsuite $RPM_BUILD_ROOT%{_datadir}/systemtap + +# We want the manuals in the special doc dir, not the generic doc install dir. +# We build it in place and then move it away so it doesn't get installed +# twice. rpm can specify itself where the (versioned) docs go with the +# %doc directive. +mkdir docs.installed +mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/*.pdf docs.installed/ +%if %{with_docs} +%if %{with_htmldocs} +mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/tapsets docs.installed/ +mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/SystemTap_Beginners_Guide docs.installed/ +%endif +%endif + +install -D -m 644 macros.systemtap $RPM_BUILD_ROOT%{_rpmmacrodir}/macros.systemtap + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/stap-server +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/stap-server +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/stap-server/.systemtap +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/stap-server +touch $RPM_BUILD_ROOT%{_localstatedir}/log/stap-server/log +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/cache/systemtap +mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/systemtap +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d +install -m 644 initscript/logrotate.stap-server $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/stap-server + +# If using systemd systemtap.service file, retain the old init script in %{_libexecdir} as a helper. +%if %{with_systemd} +mkdir -p $RPM_BUILD_ROOT%{_unitdir} +touch $RPM_BUILD_ROOT%{_unitdir}/systemtap.service +install -m 644 initscript/systemtap.service $RPM_BUILD_ROOT%{_unitdir}/systemtap.service +mkdir -p $RPM_BUILD_ROOT%{_sbindir} +install -m 755 initscript/systemtap $RPM_BUILD_ROOT%{_sbindir}/systemtap-service +%else +mkdir -p $RPM_BUILD_ROOT%{initdir} +install -m 755 initscript/systemtap $RPM_BUILD_ROOT%{initdir} +mkdir -p $RPM_BUILD_ROOT%{_sbindir} +ln -sf %{initdir}/systemtap $RPM_BUILD_ROOT%{_sbindir}/systemtap-service +# TODO CHECK CORRECTNESS: symlink %{_sbindir}/systemtap-service to %{initdir}/systemtap +%endif + +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemtap +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemtap/conf.d +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/systemtap/script.d +install -m 644 initscript/config.systemtap $RPM_BUILD_ROOT%{_sysconfdir}/systemtap/config + +%if %{with_systemd} +mkdir -p $RPM_BUILD_ROOT%{_unitdir} +touch $RPM_BUILD_ROOT%{_unitdir}/stap-server.service +install -m 644 stap-server.service $RPM_BUILD_ROOT%{_unitdir}/stap-server.service +mkdir -p $RPM_BUILD_ROOT%{_tmpfilesdir} +install -m 644 stap-server.conf $RPM_BUILD_ROOT%{_tmpfilesdir}/stap-server.conf +%else +install -m 755 initscript/stap-server $RPM_BUILD_ROOT%{initdir} +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/stap-server/conf.d +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig +install -m 644 initscript/config.stap-server $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/stap-server +%endif + +%if %{with_emacsvim} +mkdir -p $RPM_BUILD_ROOT%{_emacs_sitelispdir} +install -p -m 644 emacs/systemtap-mode.el* $RPM_BUILD_ROOT%{_emacs_sitelispdir} +mkdir -p $RPM_BUILD_ROOT%{_emacs_sitestartdir} +install -p -m 644 emacs/systemtap-init.el $RPM_BUILD_ROOT%{_emacs_sitestartdir}/systemtap-init.el +for subdir in ftdetect ftplugin indent syntax +do + mkdir -p $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles/$subdir + install -p -m 644 vim/$subdir/*.vim $RPM_BUILD_ROOT%{_datadir}/vim/vimfiles/$subdir +done +%endif + +%if %{with_virtguest} + mkdir -p $RPM_BUILD_ROOT%{udevrulesdir} + %if %{with_systemd} + install -p -m 644 staprun/guest/99-stapsh.rules $RPM_BUILD_ROOT%{udevrulesdir} + mkdir -p $RPM_BUILD_ROOT%{_unitdir} + install -p -m 644 staprun/guest/stapsh@.service $RPM_BUILD_ROOT%{_unitdir} + %else + install -p -m 644 staprun/guest/99-stapsh-init.rules $RPM_BUILD_ROOT%{udevrulesdir} + install -p -m 755 staprun/guest/stapshd $RPM_BUILD_ROOT%{initdir} + mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/systemtap + install -p -m 755 staprun/guest/stapsh-daemon $RPM_BUILD_ROOT%{_libexecdir}/systemtap + mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/modules + # Technically, this is only needed for RHEL5, in which the MODULE_ALIAS is missing, but + # it does no harm in RHEL6 as well + install -p -m 755 staprun/guest/virtio_console.modules $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/modules + %endif +%endif + +%if %{with_dracut} + mkdir -p $RPM_BUILD_ROOT%{dracutstap} + install -p -m 755 initscript/99stap/module-setup.sh $RPM_BUILD_ROOT%{dracutstap} + install -p -m 755 initscript/99stap/install $RPM_BUILD_ROOT%{dracutstap} + install -p -m 755 initscript/99stap/check $RPM_BUILD_ROOT%{dracutstap} + install -p -m 755 initscript/99stap/start-staprun.sh $RPM_BUILD_ROOT%{dracutstap} + touch $RPM_BUILD_ROOT%{dracutstap}/params.conf +%endif + +%if %{with_specific_python} +# Some files got ambiguous python shebangs, we fix them after everything else is done +pathfix.py -pni "%{__python3} %{py3_shbang_opts}" %{buildroot}%{python3_sitearch} %{buildroot}%{_bindir}/* +%endif + +%pre runtime +getent group stapusr >/dev/null || groupadd -f -g 156 -r stapusr +getent group stapsys >/dev/null || groupadd -f -g 157 -r stapsys +getent group stapdev >/dev/null || groupadd -f -g 158 -r stapdev +exit 0 + +%pre server +getent group stap-server >/dev/null || groupadd -f -g 155 -r stap-server +getent passwd stap-server >/dev/null || \ + useradd -c "Systemtap Compile Server" -u 155 -g stap-server -d %{_localstatedir}/lib/stap-server -r -s /sbin/nologin stap-server 2>/dev/null || \ + useradd -c "Systemtap Compile Server" -g stap-server -d %{_localstatedir}/lib/stap-server -r -s /sbin/nologin stap-server + +%pre testsuite +getent passwd stapusr >/dev/null || \ + useradd -c "Systemtap 'stapusr' User" -g stapusr -r -s /sbin/nologin stapusr +getent passwd stapsys >/dev/null || \ + useradd -c "Systemtap 'stapsys' User" -g stapsys -G stapusr -r -s /sbin/nologin stapsys +getent passwd stapdev >/dev/null || \ + useradd -c "Systemtap 'stapdev' User" -g stapdev -G stapusr -r -s /sbin/nologin stapdev +exit 0 + +%post server + +# We have some duplication between the %files listings for the +# ~stap-server directories and the explicit mkdir/chown/chmod bits +# here. Part of the reason may be that a preexisting stap-server +# account may well be placed somewhere other than +# %{_localstatedir}/lib/stap-server, but we'd like their permissions +# set similarly. + +test -e ~stap-server && chmod 750 ~stap-server + +if [ ! -f ~stap-server/.systemtap/rc ]; then + mkdir -p ~stap-server/.systemtap + chown stap-server:stap-server ~stap-server/.systemtap + # PR16276: guess at a reasonable number for a default --rlimit-nproc + numcpu=`/usr/bin/getconf _NPROCESSORS_ONLN` + if [ -z "$numcpu" -o "$numcpu" -lt 1 ]; then numcpu=1; fi + nproc=`expr $numcpu \* 30` + echo "--rlimit-as=614400000 --rlimit-cpu=60 --rlimit-nproc=$nproc --rlimit-stack=1024000 --rlimit-fsize=51200000" > ~stap-server/.systemtap/rc + chown stap-server:stap-server ~stap-server/.systemtap/rc +fi + +test -e %{_localstatedir}/log/stap-server/log || { + touch %{_localstatedir}/log/stap-server/log + chmod 644 %{_localstatedir}/log/stap-server/log + chown stap-server:stap-server %{_localstatedir}/log/stap-server/log +} +# Prepare the service +%if %{with_systemd} + # Note, Fedora policy doesn't allow network services enabled by default + # /bin/systemctl enable stap-server.service >/dev/null 2>&1 || : + /bin/systemd-tmpfiles --create %{_tmpfilesdir}/stap-server.conf >/dev/null 2>&1 || : +%else + /sbin/chkconfig --add stap-server +%endif +exit 0 + +%triggerin client -- systemtap-server +if test -e ~stap-server/.systemtap/ssl/server/stap.cert; then + # echo Authorizing ssl-peer/trusted-signer certificate for local systemtap-server + %{_libexecdir}/systemtap/stap-authorize-cert ~stap-server/.systemtap/ssl/server/stap.cert %{_sysconfdir}/systemtap/ssl/client >/dev/null + %{_libexecdir}/systemtap/stap-authorize-cert ~stap-server/.systemtap/ssl/server/stap.cert %{_sysconfdir}/systemtap/staprun >/dev/null +fi +exit 0 +# XXX: corresponding %triggerun? + +%preun server +# Check that this is the actual deinstallation of the package, as opposed to +# just removing the old package on upgrade. +if [ $1 = 0 ] ; then + %if %{with_systemd} + /bin/systemctl --no-reload disable stap-server.service >/dev/null 2>&1 || : + /bin/systemctl stop stap-server.service >/dev/null 2>&1 || : + %else + /sbin/service stap-server stop >/dev/null 2>&1 + /sbin/chkconfig --del stap-server + %endif +fi +exit 0 + +%postun server +# Check whether this is an upgrade of the package. +# If so, restart the service if it's running +if [ "$1" -ge "1" ] ; then + %if %{with_systemd} + /bin/systemctl condrestart stap-server.service >/dev/null 2>&1 || : + %else + /sbin/service stap-server condrestart >/dev/null 2>&1 || : + %endif +fi +exit 0 + +%post initscript +%if %{with_systemd} + /bin/systemctl enable systemtap.service >/dev/null 2>&1 || : +%else + /sbin/chkconfig --add systemtap +%endif +exit 0 + +%preun initscript +# Check that this is the actual deinstallation of the package, as opposed to +# just removing the old package on upgrade. +if [ $1 = 0 ] ; then + %if %{with_systemd} + /bin/systemctl --no-reload disable systemtap.service >/dev/null 2>&1 || : + /bin/systemctl stop systemtap.service >/dev/null 2>&1 || : + %else + /sbin/service systemtap stop >/dev/null 2>&1 + /sbin/chkconfig --del systemtap + %endif +fi +exit 0 + +%postun initscript +# Check whether this is an upgrade of the package. +# If so, restart the service if it's running +if [ "$1" -ge "1" ] ; then + %if %{with_systemd} + /bin/systemctl condrestart systemtap.service >/dev/null 2>&1 || : + %else + /sbin/service systemtap condrestart >/dev/null 2>&1 || : + %endif +fi +exit 0 + +%post runtime-virtguest +%if %{with_systemd} + # Start services if there are ports present + if [ -d /dev/virtio-ports ]; then + (find /dev/virtio-ports -iname 'org.systemtap.stapsh.[0-9]*' -type l \ + | xargs -n 1 basename \ + | xargs -n 1 -I {} /bin/systemctl start stapsh@{}.service) >/dev/null 2>&1 || : + fi +%else + /sbin/chkconfig --add stapshd + /sbin/chkconfig stapshd on + /sbin/service stapshd start >/dev/null 2>&1 || : +%endif +exit 0 + +%preun runtime-virtguest +# Stop service if this is an uninstall rather than an upgrade +if [ $1 = 0 ]; then + %if %{with_systemd} + # We need to stop all stapsh services. Because they are instantiated from + # a template service file, we can't simply call disable. We need to find + # all the running ones and stop them all individually + for service in `/bin/systemctl --full | grep stapsh@ | cut -d ' ' -f 1`; do + /bin/systemctl stop $service >/dev/null 2>&1 || : + done + %else + /sbin/service stapshd stop >/dev/null 2>&1 + /sbin/chkconfig --del stapshd + %endif +fi +exit 0 + +%postun runtime-virtguest +# Restart service if this is an upgrade rather than an uninstall +if [ "$1" -ge "1" ]; then + %if %{with_systemd} + # We need to restart all stapsh services. Because they are instantiated from + # a template service file, we can't simply call restart. We need to find + # all the running ones and restart them all individually + for service in `/bin/systemctl --full | grep stapsh@ | cut -d ' ' -f 1`; do + /bin/systemctl condrestart $service >/dev/null 2>&1 || : + done + %else + /sbin/service stapshd condrestart >/dev/null 2>&1 + %endif +fi +exit 0 + +%if %{with_python3} +%if %{with_systemd} +%preun exporter +if [ $1 = 0 ] ; then + /bin/systemctl stop stap-exporter.service >/dev/null 2>&1 || : + /bin/systemctl disable stap-exporter.service >/dev/null 2>&1 || : +fi +exit 0 + +%postun exporter +# Restart service if this is an upgrade rather than an uninstall +if [ "$1" -ge "1" ]; then + /bin/systemctl condrestart stap-exporter >/dev/null 2>&1 || : +fi +exit 0 +%endif +%endif + +%post +# Remove any previously-built uprobes.ko materials +(make -C %{_datadir}/systemtap/runtime/uprobes clean) >/dev/null 2>&1 || true +(/sbin/rmmod uprobes) >/dev/null 2>&1 || true + +%preun +# Ditto +(make -C %{_datadir}/systemtap/runtime/uprobes clean) >/dev/null 2>&1 || true +(/sbin/rmmod uprobes) >/dev/null 2>&1 || true + +# ------------------------------------------------------------------------ + +%files +# The main "systemtap" rpm doesn't include any files. + +%files server -f systemtap.lang +%{_bindir}/stap-server +%dir %{_libexecdir}/systemtap +%{_libexecdir}/systemtap/stap-serverd +%{_libexecdir}/systemtap/stap-start-server +%{_libexecdir}/systemtap/stap-stop-server +%{_libexecdir}/systemtap/stap-gen-cert +%{_libexecdir}/systemtap/stap-sign-module +%{_libexecdir}/systemtap/stap-authorize-cert +%{_libexecdir}/systemtap/stap-env +%{_mandir}/man7/error* +%{_mandir}/man7/stappaths.7* +%{_mandir}/man7/warning* +%{_mandir}/man8/stap-server.8* +%if %{with_systemd} +%{_unitdir}/stap-server.service +%{_tmpfilesdir}/stap-server.conf +%else +%{initdir}/stap-server +%dir %{_sysconfdir}/stap-server/conf.d +%config(noreplace) %{_sysconfdir}/sysconfig/stap-server +%endif +%config(noreplace) %{_sysconfdir}/logrotate.d/stap-server +%dir %{_sysconfdir}/stap-server +%dir %attr(0750,stap-server,stap-server) %{_localstatedir}/lib/stap-server +%dir %attr(0700,stap-server,stap-server) %{_localstatedir}/lib/stap-server/.systemtap +%dir %attr(0755,stap-server,stap-server) %{_localstatedir}/log/stap-server +%ghost %config(noreplace) %attr(0644,stap-server,stap-server) %{_localstatedir}/log/stap-server/log +%ghost %attr(0755,stap-server,stap-server) %{_localstatedir}/run/stap-server +%doc README README.unprivileged AUTHORS NEWS +%{!?_licensedir:%global license %%doc} +%license COPYING + + +%files devel -f systemtap.lang +%{_bindir}/stap +%{_bindir}/stap-prep +%{_bindir}/stap-report +%dir %{_datadir}/systemtap +%{_datadir}/systemtap/runtime +%{_datadir}/systemtap/tapset +%{_mandir}/man1/stap.1* +%{_mandir}/man1/stap-prep.1* +%{_mandir}/man1/stap-report.1* +%{_mandir}/man7/error* +%{_mandir}/man7/stappaths.7* +%{_mandir}/man7/warning* +%doc README README.unprivileged AUTHORS NEWS +%{!?_licensedir:%global license %%doc} +%license COPYING +%if %{with_java} +%dir %{_libexecdir}/systemtap +%{_libexecdir}/systemtap/libHelperSDT.so +%endif +%if %{with_emacsvim} +%{_emacs_sitelispdir}/*.el* +%{_emacs_sitestartdir}/systemtap-init.el +%{_datadir}/vim/vimfiles/*/*.vim +%endif +# Notice that the stap-resolve-module-function.py file is used by +# *both* the python2 and python3 subrpms. Both subrpms use that same +# python script to help list python probes. +%if %{with_python3_probes} || %{with_python2_probes} +%{_libexecdir}/systemtap/python/stap-resolve-module-function.py +%exclude %{_libexecdir}/systemtap/python/stap-resolve-module-function.py? +%endif + + +%files runtime -f systemtap.lang +%attr(4110,root,stapusr) %{_bindir}/staprun +%{_bindir}/stapsh +%{_bindir}/stap-merge +%{_bindir}/stap-report +%if %{with_dyninst} +%{_bindir}/stapdyn +%endif +%if %{with_bpf} +%{_bindir}/stapbpf +%endif +%dir %{_libexecdir}/systemtap +%{_libexecdir}/systemtap/stapio +%{_libexecdir}/systemtap/stap-authorize-cert +%if %{with_crash} +%dir %{_libdir}/systemtap +%{_libdir}/systemtap/staplog.so* +%endif +%{_mandir}/man1/stap-report.1* +%{_mandir}/man7/error* +%{_mandir}/man7/stappaths.7* +%{_mandir}/man7/warning* +%{_mandir}/man8/stapsh.8* +%{_mandir}/man8/staprun.8* +%if %{with_dyninst} +%{_mandir}/man8/stapdyn.8* +%endif +%if %{with_bpf} +%{_mandir}/man8/stapbpf.8* +%endif +%doc README README.security AUTHORS NEWS +%{!?_licensedir:%global license %%doc} +%license COPYING + + +%files client -f systemtap.lang +%doc README README.unprivileged AUTHORS NEWS +%{_datadir}/systemtap/examples +%{!?_licensedir:%global license %%doc} +%license COPYING +%doc docs.installed/*.pdf +%if %{with_docs} +%if %{with_htmldocs} +%doc docs.installed/tapsets/*.html +%doc docs.installed/SystemTap_Beginners_Guide +%endif +%endif +%{_bindir}/stap +%{_bindir}/stap-prep +%{_bindir}/stap-report +%{_mandir}/man1/stap.1* +%{_mandir}/man1/stap-prep.1* +%{_mandir}/man1/stap-merge.1* +%{_mandir}/man1/stap-report.1* +%{_mandir}/man1/stapref.1* +%{_mandir}/man3/* +%{_mandir}/man7/error* +%{_mandir}/man7/stappaths.7* +%{_mandir}/man7/warning* +%dir %{_datadir}/systemtap +%{_datadir}/systemtap/tapset + + + +%files initscript +%if %{with_systemd} +%{_unitdir}/systemtap.service +%{_sbindir}/systemtap-service +%else +%{initdir}/systemtap +%{_sbindir}/systemtap-service +%endif +%dir %{_sysconfdir}/systemtap +%dir %{_sysconfdir}/systemtap/conf.d +%dir %{_sysconfdir}/systemtap/script.d +%config(noreplace) %{_sysconfdir}/systemtap/config +%dir %{_localstatedir}/cache/systemtap +%ghost %{_localstatedir}/run/systemtap +%{_mandir}/man8/systemtap-service.8* +%if %{with_dracut} + %dir %{dracutstap} + %{dracutstap}/* +%endif + + +%files sdt-devel +%{_bindir}/dtrace +%{_includedir}/sys/sdt.h +%{_includedir}/sys/sdt-config.h +%{_mandir}/man1/dtrace.1* +%{_rpmmacrodir}/macros.systemtap +%doc README AUTHORS NEWS +%{!?_licensedir:%global license %%doc} +%license COPYING + + +%files testsuite +%dir %{_datadir}/systemtap +%{_datadir}/systemtap/testsuite + + +%if %{with_java} +%files runtime-java +%dir %{_libexecdir}/systemtap +%{_libexecdir}/systemtap/libHelperSDT.so +%{_libexecdir}/systemtap/HelperSDT.jar +%{_libexecdir}/systemtap/stapbm +%endif + +%if %{with_python2_probes} +%files runtime-python2 +%{python_sitearch}/HelperSDT +%{python_sitearch}/HelperSDT-*.egg-info +%endif +%if %{with_python3_probes} +%files runtime-python3 +%{python3_sitearch}/HelperSDT +%{python3_sitearch}/HelperSDT-*.egg-info +%endif + +%if %{with_virthost} +%files runtime-virthost +%{_mandir}/man1/stapvirt.1* +%{_bindir}/stapvirt +%endif + +%if %{with_virtguest} +%files runtime-virtguest +%if %{with_systemd} + %{udevrulesdir}/99-stapsh.rules + %{_unitdir}/stapsh@.service +%else + %{udevrulesdir}/99-stapsh-init.rules + %dir %{_libexecdir}/systemtap + %{_libexecdir}/systemtap/stapsh-daemon + %{initdir}/stapshd + %{_sysconfdir}/sysconfig/modules/virtio_console.modules +%endif +%endif + +%if %{with_python3} +%files exporter +%{_sysconfdir}/stap-exporter +%{_sysconfdir}/sysconfig/stap-exporter +%{_unitdir}/stap-exporter.service +%{_mandir}/man8/stap-exporter.8* +%{_sbindir}/stap-exporter +%endif + +# ------------------------------------------------------------------------ + +# Future new-release entries should be of the form +# * DDD MMM DD YYYY YOURNAME - V-R +# - Upstream release, see wiki page below for detailed notes. +# http://sourceware.org/systemtap/wiki/SystemTapReleases + +# PRERELEASE +%changelog +* Thu Sep 09 2021 Frank Ch. Eigler - 4.5-8 +- rhbz1985124: Kernel 5.14 compatibility omnibus cont'd. + +* Thu Aug 12 2021 Frank Ch. Eigler - 4.5-7 +- rhbz1985124: Kernel 5.14 compatibility omnibus. + +* Tue Aug 10 2021 Mohan Boddu - 4.5-5 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Mon Jul 26 2021 Frank Ch. Eigler - 4.5-3 +- rhbz1982908: Import hardening c*flags from specs/rhel standards + +* Tue May 18 2021 Frank Ch. Eigler - 4.5-2 +- Respin against newer dyninst. + +* Fri May 07 2021 Frank Ch. Eigler - 4.5-1 +- Upstream release. + +* Fri Apr 16 2021 Mohan Boddu - 4.5-0.202102101545git8d5e0abc542c +- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 + +* Mon Nov 09 2020 Frank Ch. Eigler - 4.4-1 +- Upstream release. + +* Thu Jun 11 2020 Frank Ch. Eigler - 4.3-1 +- Upstream release. + +* Mon Nov 18 2019 Sagar Patel - 4.2-1 +- Upstream release. + +* Tue May 07 2019 Serguei Makarov - 4.1-1 +- Upstream release. + +* Sat Oct 13 2018 Frank Ch. Eigler - 4.0-1 +- Upstream release. + +* Thu Jun 07 2018 Frank Ch. Eigler - 3.3-1 +- Upstream release. + +* Wed Oct 18 2017 Frank Ch. Eigler - 3.2-1 +- Upstream release. + +* Fri Feb 17 2017 Frank Ch. Eigler - 3.1-1 +- Upstream release. + +* Sun Mar 27 2016 Frank Ch. Eigler - 3.0-1 +- Upstream release. + +* Thu Oct 08 2015 Frank Ch. Eigler - 2.9-1 +- Upstream release. + +* Wed Jun 17 2015 Abegail Jakop - 2.8-1 +- Upstream release. + +* Wed Feb 18 2015 Frank Ch. Eigler - 2.7-1 +- Upstream release. + +* Fri Sep 05 2014 Josh Stone - 2.6-1 +- Upstream release. + +* Mon Jul 07 2014 Josh Stone +- Flip with_dyninst to an %%ifarch passlist. + +* Wed Apr 30 2014 Jonathan Lebon - 2.5-1 +- Upstream release. + +* Thu Feb 13 2014 Lukas Berk +- Add directory checks for runtime-java sym links + +* Mon Jan 06 2014 Jonathan Lebon +- Added dracut module to initscript package + +* Wed Nov 06 2013 Frank Ch. Eigler - 2.4-1 +- Upstream release. + +* Wed Oct 09 2013 Jonathan Lebon +- Added runtime-virthost and runtime-virtguest packages. + +* Thu Jul 25 2013 Frank Ch. Eigler - 2.3-1 +- Upstream release. + +* Thu May 16 2013 Frank Ch. Eigler - 2.2.1-1 +- Upstream release. + +* Tue May 14 2013 Frank Ch. Eigler - 2.2-1 +- Upstream release. + +* Wed Feb 13 2013 Serguei Makarov - 2.1-1 +- Upstream release. + +* Tue Oct 09 2012 Josh Stone - 2.0-1 +- Upstream release. + +* Fri Jul 13 2012 Peter Robinson +- Fix ifarch statement +- use file based requires for glibc-devel on x86_64 so that we work in koji + +* Sun Jun 17 2012 Frank Ch. Eigler - 1.8-1 +- Upstream release. + +* Wed Feb 01 2012 Frank Ch. Eigler - 1.7-1 +- Upstream release. + +* Fri Jan 13 2012 David Smith - 1.6-2 +- Fixed /bin/mktemp require. + +* Mon Jul 25 2011 Stan Cox - 1.6-1 +- Upstream release. + +* Mon May 23 2011 Stan Cox - 1.5-1 +- Upstream release. + +* Mon Jan 17 2011 Frank Ch. Eigler - 1.4-1 +- Upstream release. + +* Wed Jul 21 2010 Josh Stone - 1.3-1 +- Upstream release. + +* Mon Mar 22 2010 Frank Ch. Eigler - 1.2-1 +- Upstream release. + +* Mon Dec 21 2009 David Smith - 1.1-1 +- Upstream release. + +* Tue Sep 22 2009 Josh Stone - 1.0-1 +- Upstream release. + +* Tue Aug 4 2009 Josh Stone - 0.9.9-1 +- Upstream release. + +* Thu Jun 11 2009 Josh Stone - 0.9.8-1 +- Upstream release. + +* Thu Apr 23 2009 Josh Stone - 0.9.7-1 +- Upstream release. + +* Fri Mar 27 2009 Josh Stone - 0.9.5-1 +- Upstream release. + +* Wed Mar 18 2009 Will Cohen - 0.9-2 +- Add location of man pages. + +* Tue Feb 17 2009 Frank Ch. Eigler - 0.9-1 +- Upstream release. + +* Thu Nov 13 2008 Frank Ch. Eigler - 0.8-1 +- Upstream release. + +* Tue Jul 15 2008 Frank Ch. Eigler - 0.7-1 +- Upstream release. + +* Fri Feb 1 2008 Frank Ch. Eigler - 0.6.1-3 +- Add zlib-devel to buildreq; missing from crash-devel +- Process testsuite .stp files for #!stap->#!/usr/bin/stap + +* Fri Jan 18 2008 Frank Ch. Eigler - 0.6.1-1 +- Add crash-devel buildreq to build staplog.so crash(8) module. +- Many robustness & functionality improvements: + +* Wed Dec 5 2007 Will Cohen - 0.6-2 +- Correct Source to point to location contain code. + +* Thu Aug 9 2007 David Smith - 0.6-1 +- Bumped version, added libcap-devel BuildRequires. + +* Wed Jul 11 2007 Will Cohen - 0.5.14-2 +- Fix Requires and BuildRequires for sqlite. + +* Mon Jul 2 2007 Frank Ch. Eigler - 0.5.14-1 +- Many robustness improvements: 1117, 1134, 1305, 1307, 1570, 1806, + 2033, 2116, 2224, 2339, 2341, 2406, 2426, 2438, 2583, 3037, + 3261, 3282, 3331, 3428 3519, 3545, 3625, 3648, 3880, 3888, 3911, + 3952, 3965, 4066, 4071, 4075, 4078, 4081, 4096, 4119, 4122, 4127, + 4146, 4171, 4179, 4183, 4221, 4224, 4254, 4281, 4319, 4323, 4326, + 4329, 4332, 4337, 4415, 4432, 4444, 4445, 4458, 4467, 4470, 4471, + 4518, 4567, 4570, 4579, 4589, 4609, 4664 + +* Mon Mar 26 2007 Frank Ch. Eigler - 0.5.13-1 +- An emergency / preliminary refresh, mainly for compatibility + with 2.6.21-pre kernels. + +* Mon Jan 1 2007 Frank Ch. Eigler - 0.5.12-1 +- Many changes, see NEWS file. + +* Tue Sep 26 2006 David Smith - 0.5.10-1 +- Added 'systemtap-runtime' subpackage. + +* Wed Jul 19 2006 Roland McGrath - 0.5.9-1 +- PRs 2669, 2913 + +* Fri Jun 16 2006 Roland McGrath - 0.5.8-1 +- PRs 2627, 2520, 2228, 2645 + +* Fri May 5 2006 Frank Ch. Eigler - 0.5.7-1 +- PRs 2511 2453 2307 1813 1944 2497 2538 2476 2568 1341 2058 2220 2437 + 1326 2014 2599 2427 2438 2465 1930 2149 2610 2293 2634 2506 2433 + +* Tue Apr 4 2006 Roland McGrath - 0.5.5-1 +- Many changes, affected PRs include: 2068, 2293, 1989, 2334, + 1304, 2390, 2425, 953. + +* Wed Feb 1 2006 Frank Ch. Eigler - 0.5.4-1 +- PRs 1916, 2205, 2142, 2060, 1379 + +* Mon Jan 16 2006 Roland McGrath - 0.5.3-1 +- Many changes, affected PRs include: 2056, 1144, 1379, 2057, + 2060, 1972, 2140, 2148 + +* Mon Dec 19 2005 Roland McGrath - 0.5.2-1 +- Fixed build with gcc 4.1, various tapset changes. + +* Wed Dec 7 2005 Roland McGrath - 0.5.1-1 +- elfutils update, build changes + +* Fri Dec 02 2005 Frank Ch. Eigler - 0.5-1 +- Many fixes and improvements: 1425, 1536, 1505, 1380, 1329, 1828, 1271, + 1339, 1340, 1345, 1837, 1917, 1903, 1336, 1868, 1594, 1564, 1276, 1295 + +* Mon Oct 31 2005 Roland McGrath - 0.4.2-1 +- Many fixes and improvements: PRs 1344, 1260, 1330, 1295, 1311, 1368, + 1182, 1131, 1332, 1366, 1456, 1271, 1338, 1482, 1477, 1194. + +* Wed Sep 14 2005 Roland McGrath - 0.4.1-1 +- Many fixes and improvements since 0.2.2; relevant PRs include: + 1122, 1134, 1155, 1172, 1174, 1175, 1180, 1186, 1187, 1191, 1193, 1195, + 1197, 1205, 1206, 1209, 1213, 1244, 1257, 1258, 1260, 1265, 1268, 1270, + 1289, 1292, 1306, 1335, 1257 + +* Wed Sep 7 2005 Frank Ch. Eigler +- Bump version. + +* Tue Aug 16 2005 Frank Ch. Eigler +- Bump version. + +* Wed Aug 3 2005 Martin Hunt - 0.2.2-1 +- Add directory /var/cache/systemtap +- Add stp_check to /usr/libexec/systemtap + +* Wed Aug 3 2005 Roland McGrath - 0.2.1-1 +- New version 0.2.1, various fixes. + +* Fri Jul 29 2005 Roland McGrath - 0.2-1 +- New version 0.2, requires elfutils 0.111 + +* Mon Jul 25 2005 Roland McGrath +- Clean up spec file, build bundled elfutils. + +* Thu Jul 21 2005 Martin Hunt +- Set Version to use version from autoconf. +- Fix up some of the path names. +- Add Requires and BuildRequires. + +* Tue Jul 19 2005 Will Cohen +- Initial creation of RPM.