import systemtap-4.5-7.el9

This commit is contained in:
CentOS Sources 2021-12-07 12:31:01 -05:00 committed by Stepan Oksanichenko
commit 041325fbf8
8 changed files with 2658 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/systemtap-4.5.tar.gz

1
.systemtap.metadata Normal file
View File

@ -0,0 +1 @@
c549d5fa7aaf6a8cef3371f5757d912d41eae934 SOURCES/systemtap-4.5.tar.gz

24
SOURCES/rhbz1972803.patch Normal file
View File

@ -0,0 +1,24 @@
commit eaf63df6a429956bdc03f2ecd8fc2b6fa50321a8
Author: Frank Ch. Eigler <fche@redhat.com>
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;
}

52
SOURCES/rhbz1972805.patch Normal file
View File

@ -0,0 +1,52 @@
commit 5409ddea1a007384b9c71a78e8dd2cbca1fc5424
Author: Frank Ch. Eigler <fche@redhat.com>
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. */

29
SOURCES/rhbz1972828.patch Normal file
View File

@ -0,0 +1,29 @@
commit 515a6a2d63cdf16c5bc599f0d29283289219d9a4
Author: Frank Ch. Eigler <fche@redhat.com>
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<string> tracepoint_extra_decls (systemtap_session& s,
they_live.push_back ("#include <linux/phy.h>");
}
+ 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

222
SOURCES/rhbz1982908.patch Normal file
View File

@ -0,0 +1,222 @@
commit 04b43f48f1091bdc4bfdbabae86745547e539f8c
Author: Frank Ch. Eigler <fche@redhat.com>
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

854
SOURCES/rhbz1985124.patch Normal file
View File

@ -0,0 +1,854 @@
commit 7c2751e37f97e95d77898d68b7c08cbf1be7f7d9
Author: Sultan Alsawaf <sultan@openresty.com>
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 <linux/rculist.h>
+
+void foo(struct hlist_node *n, struct hlist_head *h)
+{
+ hlist_add_tail_rcu(n, h);
+}
commit ef5a8b9eda402e4e96c4e3ce01e7ff95d3e10470
Author: Du Zhe <duzhe0211+sourceware@gmail.com>
Date: Tue Jul 13 19:11:55 2021 -0400
runtime: fix unintended compile error with autoconf-x86-uniregs.c
Adding a #include <linux/sched.h> 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 <linux/sched.h>
#include <asm/ptrace.h>
#if defined (__i386__) || defined (__x86_64__)
commit 968173f7fb97675de94c8ca47e6b6898b1117a1d
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Tue Jul 13 19:34:50 2021 -0400
runtime: linux 5.14 compat: <linux/panic_notifier.h>
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 <linux/panic_notifier.h>
+
+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 <linux/security.h>
#endif
+#ifdef STAPCONF_514_PANIC
+#include <linux/panic_notifier.h>
+#endif
#include "../uidgid_compatibility.h"
static int _stp_exit_flag = 0;
commit a29f65d5750f6379afeca99c5d641598ff638517
Author: Stan Cox <scox@redhat.com>
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 <peterz@infradead.org>
+ * 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 <linux/sched.h>
+
+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 <fche@redhat.com>
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 <linux/compiler_attribute.h> */
+#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 <linux/user_namespace.h>
#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 <fche@redhat.com>
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 <fche@redhat.com>
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 <linux/compiler_attribute.h> */
+#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 <fche@redhat.com>
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 <fche@redhat.com>
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 <zhuizhuhaomeng@gmail.com>
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 <linux/fdtable.h>
+#include <linux/file.h>
+
+void
+foo(void)
+{
+ struct file *filp = files_lookup_fd_raw(NULL, 0);
+ (void) filp;
+}
commit f2c1477678ecc2b03b55e21c31747004e2c78717
Author: Junlong Li <zhuizhuhaomeng@gmail.com>
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);
}

1475
SPECS/systemtap.spec Normal file

File diff suppressed because it is too large Load Diff