diff --git a/rhbz1972803.patch b/rhbz1972803.patch new file mode 100644 index 0000000..48dd753 --- /dev/null +++ b/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/rhbz1972805.patch b/rhbz1972805.patch new file mode 100644 index 0000000..4c95f78 --- /dev/null +++ b/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/rhbz1972828.patch b/rhbz1972828.patch new file mode 100644 index 0000000..9598ac8 --- /dev/null +++ b/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/systemtap.spec b/systemtap.spec index 595af6a..2c364a0 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -90,7 +90,7 @@ Name: systemtap Version: 4.5 -Release: 2%{?release_override}%{?dist} +Release: 3%{?release_override}%{?dist} # for version, see also configure.ac @@ -126,6 +126,11 @@ 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 + + # Build* BuildRequires: make BuildRequires: gcc-c++ @@ -536,6 +541,9 @@ systemtap-runtime-virthost machine to execute systemtap scripts. %prep %setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 %build