diff --git a/rhbz1997192.patch b/rhbz1997192.patch new file mode 100644 index 0000000..4500e85 --- /dev/null +++ b/rhbz1997192.patch @@ -0,0 +1,50 @@ +commit 47cab810bb7ea315a2dec23c2f61e7ba74515b82 +Author: Martin Cermak +Date: Fri Dec 16 16:08:20 2022 -0500 + + tapset: nfs.proc.commit_done compilation on some kernels + + Correct: + 9.0 Server x86_64 # stap -vp3 nfs.proc.commit_done.stp + + Pass 1: parsed user script and 482 library scripts using 108088virt/88468res/12460shr/75476data kb, in 190usr/60sys/501real ms. + semantic error: invalid access '->task' vs 'void*': operator '->' at /usr/share/systemtap/tapset/linux/nfs_proc.stpm:16:21 + source: ( get_ip(&@nfs_data->task) ) + ^ + in expansion of macro: operator '@_nfs_data_server_ip' at /usr/share/systemtap/tapset/linux/nfs_proc.stp:1421:15 + source: server_ip = @_nfs_data_server_ip($task->tk_calldata) + ^ + +diff --git a/tapset/linux/nfs_proc.stp b/tapset/linux/nfs_proc.stp +index 9b1f65f5f..4413384f9 100644 +--- a/tapset/linux/nfs_proc.stp ++++ b/tapset/linux/nfs_proc.stp +@@ -1442,10 +1442,11 @@ probe nfs.proc3.commit_done = kernel.function("nfs3_commit_done") !, + valid = @_nfs_data_valid($data) + } + else { +- server_ip = @_nfs_data_server_ip($task->tk_calldata) +- prot = @_nfs_data_prot($task->tk_calldata) +- count = @_nfs_data_res_count($task->tk_calldata) +- valid = @_nfs_data_valid($task->tk_calldata) ++ _tk_calldata=@choose_defined($task->tk_calldata, @cast($task, "rpc_task", "kernel:nfs")->tk_calldata) ++ server_ip = @_nfs_data_server_ip(_tk_calldata) ++ prot = @_nfs_data_prot(_tk_calldata) ++ count = @_nfs_data_res_count(_tk_calldata) ++ valid = @_nfs_data_valid(_tk_calldata) + } + timestamp = 0 + version = 3 +diff --git a/tapset/linux/nfs_proc.stpm b/tapset/linux/nfs_proc.stpm +index 8576c0f33..4fe40b2a5 100644 +--- a/tapset/linux/nfs_proc.stpm ++++ b/tapset/linux/nfs_proc.stpm +@@ -13,7 +13,7 @@ + + @define _nfs_data_server_ip(nfs_data) + %( +- ( get_ip(&@nfs_data->task) ) ++ ( get_ip(@choose_defined(&@nfs_data->task, &@cast(@nfs_data, "nfs_commit_data", "kernel:nfs")->task)) ) + %) + + @define _nfs_data_prot(nfs_data) diff --git a/rhbz2145242.patch b/rhbz2145242.patch new file mode 100644 index 0000000..1853a64 --- /dev/null +++ b/rhbz2145242.patch @@ -0,0 +1,30 @@ +commit 578e60102871d11ed8c18d36f6286f3a96258d8f +Author: Ryan Goldberg +Date: Thu Dec 1 16:15:44 2022 -0500 + + PR29676: Wildcard expansion fix for labels + + PR29676, introduced an bug where function symbols from the symbol + table were expanded in the function component resulting in wildcards + not being expanded in labels. This fix, removes the issue by restricting + the symbol table query to probes which don't need further debuginfo to + expand. + +diff --git a/tapsets.cxx b/tapsets.cxx +index 0ec71ebda..46b10f26e 100644 +--- a/tapsets.cxx ++++ b/tapsets.cxx +@@ -1256,7 +1256,11 @@ dwarf_query::handle_query_module() + // in the symbol table but not in dwarf and minidebuginfo is + // located in the gnu_debugdata section, alias_dupes checking + // is done before adding any probe points +- if(!pending_interrupts) ++ // PR29676. Some probes require additional debuginfo ++ // to expand wildcards (ex. .label, .callee). Since the debuginfo is ++ // not available, don't bother looking in the symbol table for these results. ++ // This can result in 0 results, if there is no dwarf info present ++ if(!pending_interrupts && !(has_label || has_callee || has_callees_num)) + query_module_symtab(); + } + + diff --git a/rhbz2149223.patch b/rhbz2149223.patch new file mode 100644 index 0000000..75ba486 --- /dev/null +++ b/rhbz2149223.patch @@ -0,0 +1,78 @@ +commit 05eb6742c169226ae09f1737aa8b9dc1dc12adb5 +Author: Mark Wielaard +Date: Tue Nov 29 18:50:58 2022 +0100 + + Handle DWARF5 DW_OP_implicit_pointer and DW_OP_entry_value + + These are the same as the GNU extensions for older DWARF, + DW_OP_GNU_implicit_pointer and DW_GNU_entry_value. + +diff --git a/loc2stap.cxx b/loc2stap.cxx +index efc78cc57..53316a480 100644 +--- a/loc2stap.cxx ++++ b/loc2stap.cxx +@@ -23,6 +23,11 @@ + #define DW_OP_GNU_entry_value 0xf3 + #endif + ++#if ! _ELFUTILS_PREREQ(0, 171) ++#define DW_OP_entry_value 0xa3 ++#define DW_OP_implicit_pointer 0xa0 ++#endif ++ + #define N_(x) x + + +@@ -372,7 +377,7 @@ location_context::translate (const Dwarf_Op *expr, const size_t len, + DIE ("operations follow DW_OP_implicit_value"); + + if (implicit_pointer != NULL) +- DIE ("operations follow DW_OP_GNU_implicit_pointer"); ++ DIE ("operations follow DW_OP implicit_pointer"); + } + + switch (expr[i].atom) +@@ -662,6 +667,7 @@ location_context::translate (const Dwarf_Op *expr, const size_t len, + + #if _ELFUTILS_PREREQ (0, 149) + case DW_OP_GNU_implicit_pointer: ++ case DW_OP_implicit_pointer: + implicit_pointer = &expr[i]; + /* Fake top of stack: implicit_pointer being set marks it. */ + PUSH(NULL); +@@ -684,10 +690,11 @@ location_context::translate (const Dwarf_Op *expr, const size_t len, + break; + + case DW_OP_GNU_entry_value: ++ case DW_OP_entry_value: + { + expression *result = handle_GNU_entry_value (expr[i]); + if (result == NULL) +- DIE("DW_OP_GNU_entry_value unable to resolve value"); ++ DIE("DW_OP entry_value unable to resolve value"); + PUSH(result); + } + break; +@@ -1248,7 +1255,8 @@ location_context::location_relative (const Dwarf_Op *expr, size_t len, + break; + + case DW_OP_GNU_entry_value: +- DIE ("unhandled DW_OP_GNU_entry_value"); ++ case DW_OP_entry_value: ++ DIE ("unhandled DW_OP entry_value"); + break; + + default: +diff --git a/testsuite/systemtap.base/dw_entry_value.exp b/testsuite/systemtap.base/dw_entry_value.exp +index 7339fc5fa..b728fa7ff 100644 +--- a/testsuite/systemtap.base/dw_entry_value.exp ++++ b/testsuite/systemtap.base/dw_entry_value.exp +@@ -10,7 +10,7 @@ if { $res != "" } { + pass "$test: compiled $test.c" + } + +-if { ![catch { exec eu-readelf -w $test | grep GNU_entry_value }] } { ++if { ![catch { exec eu-readelf -w $test | grep entry_value: }] } { + stap_run $test no_load $all_pass_string $srcdir/$subdir/$test.stp -c ./${test} -w + } else { + untested "$test: no DW_OP_GNU_entry_value found" diff --git a/rhbz2149666.patch b/rhbz2149666.patch new file mode 100644 index 0000000..74be846 --- /dev/null +++ b/rhbz2149666.patch @@ -0,0 +1,73 @@ +commit 7eed8d1fef36997b9e4c1d9cdb67643483a51e56 +Author: William Cohen +Date: Fri Nov 4 11:12:05 2022 -0400 + + Ensure that SystemTap runtime uses smp_processor_id() in proper context + + There were cases on Fedora 36 and Rawhide running kernels with + CONFIG_DEBUG_PREEMPT=y where systemtap scripts would trigger kernel + log messages like the following: + + [ 257.544406] check_preemption_disabled: 4 callbacks suppressed + [ 257.544409] BUG: using smp_processor_id() in preemptible [00000000] code: staprun/2106 + [ 257.544465] caller is _stp_runtime_context_trylock+0x12/0x70 [stap_e36600406768aeefd49daf9fc7a3d23c_2106] + [ 257.544507] CPU: 0 PID: 2106 Comm: staprun Tainted: G OE ------- --- 6.1.0-0.rc2.20221028git23758867219c.24.fc38.x86_64 #1 + [ 257.544544] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-1.fc36 04/01/2014 + [ 257.544571] Call Trace: + [ 257.544583] + [ 257.544593] dump_stack_lvl+0x5b/0x77 + [ 257.544620] check_preemption_disabled+0xe1/0xf0 + [ 257.544641] _stp_runtime_context_trylock+0x12/0x70 [stap_e36600406768aeefd49daf9fc7a3d23c_2106] + [ 257.544673] _stp_runtime_entryfn_get_context+0xb/0x70 [stap_e36600406768aeefd49daf9fc7a3d23c_2106] + [ 257.544705] _stp_ctl_send+0x76/0x1e0 [stap_e36600406768aeefd49daf9fc7a3d23c_2106] + [ 257.544735] _stp_transport_init+0x71a/0x860 [stap_e36600406768aeefd49daf9fc7a3d23c_2106] + [ 257.544771] ? kallsyms_on_each_symbol+0x30/0x30 [stap_e36600406768aeefd49daf9fc7a3d23c_2106] + [ 257.544803] do_one_initcall+0x6b/0x320 + [ 257.544827] do_init_module+0x4a/0x200 + [ 257.544844] __do_sys_init_module+0x16a/0x1a0 + [ 257.544870] do_syscall_64+0x58/0x80 + [ 257.544885] ? up_read+0x17/0x20 + [ 257.544902] ? lock_is_held_type+0xe8/0x140 + [ 257.544921] ? asm_exc_page_fault+0x22/0x30 + [ 257.544939] ? lockdep_hardirqs_on+0x7d/0x100 + [ 257.544956] entry_SYSCALL_64_after_hwframe+0x63/0xcd + [ 257.544975] RIP: 0033:0x7f3cde12f5de + [ 257.544992] Code: 48 8b 0d 35 68 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 49 89 ca b8 af 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 02 68 0c 00 f7 d8 64 89 01 48 + [ 257.545010] RSP: 002b:00007ffc5170c418 EFLAGS: 00000246 ORIG_RAX: 00000000000000af + [ 257.545010] RAX: ffffffffffffffda RBX: 0000563620bd4020 RCX: 00007f3cde12f5de + [ 257.545010] RDX: 0000563620bd4020 RSI: 0000000000040ea0 RDI: 00007f3cde44a010 + [ 257.545010] RBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000 + [ 257.545010] R10: 0000000000000053 R11: 0000000000000246 R12: 00007ffc5170c510 + [ 257.545010] R13: 00007f3cde44a010 R14: 00007ffc5170c440 R15: 00007f3cde4631e8 + [ 257.545010] + + This issue was introduced by git commit 1641b6e7ea which added a fast + path check that used smp_processor_id() without first having a + preempt_disable(). The code now ensures that preemption is disabled + before using the smp_processor_id(). + +diff --git a/runtime/linux/runtime_context.h b/runtime/linux/runtime_context.h +index 3ed3cbd22..ee3870f32 100644 +--- a/runtime/linux/runtime_context.h ++++ b/runtime/linux/runtime_context.h +@@ -49,13 +49,18 @@ static bool _stp_runtime_context_trylock(void) + { + bool locked; + ++ /* Need to disable preemption because of the smp_processor_id() call ++ in _stp_runtime_get_context(). */ ++ preempt_disable(); ++ + /* fast path to ignore new online CPUs without percpu context memory + * allocations. this also serves as an extra safe guard for NULL context + * pointers. */ +- if (unlikely(_stp_runtime_get_context() == NULL)) ++ if (unlikely(_stp_runtime_get_context() == NULL)) { ++ preempt_enable_no_resched(); + return false; ++ } + +- preempt_disable(); + locked = atomic_add_unless(&_stp_contexts_busy_ctr, 1, INT_MAX); + if (!locked) + preempt_enable_no_resched(); diff --git a/rhbz2154430.patch b/rhbz2154430.patch new file mode 100644 index 0000000..0e6a7c2 --- /dev/null +++ b/rhbz2154430.patch @@ -0,0 +1,72 @@ +commit 8f3498781413a710dc9e128f5a96891a6a18fc52 +Author: Martin Cermak +Date: Wed Dec 14 17:37:58 2022 +0100 + + PR29766: kernel.function("__set_page_dirty_buffers") not found in vfs.stp + + Updates needed for 6.1.0-65.fc38 compatibility. + +diff --git a/tapset/linux/vfs.stp b/tapset/linux/vfs.stp +index e3c1a3032..aebeb3fc0 100644 +--- a/tapset/linux/vfs.stp ++++ b/tapset/linux/vfs.stp +@@ -822,13 +822,15 @@ probe vfs.buffer_migrate_page.return = + } + + /* default if aop not set, __set_page_dirty_nobuffers usually used if set */ +-probe vfs.__set_page_dirty_buffers = kernel.function("__set_page_dirty_buffers") ++/* block_dirty_folio related to kernel commit e621900ad28b748e058b81d6078 */ ++probe vfs.__set_page_dirty_buffers = kernel.function("__set_page_dirty_buffers")!, ++ kernel.function("block_dirty_folio") + { +- dev = __page_dev($page) +- devname = __find_bdevname(dev, __page_bdev($page)) +- ino = __page_ino($page) ++ dev = __page_dev(@choose_defined($page, $folio)) ++ devname = __find_bdevname(dev, __page_bdev(@choose_defined($page, $folio))) ++ ino = __page_ino(@choose_defined($page, $folio)) + +- index = __page_index($page) ++ index = __page_index(@choose_defined($page, $folio)) + + name = "__set_page_dirty_buffers" + argstr = sprintf("%d", index) +@@ -837,7 +839,8 @@ probe vfs.__set_page_dirty_buffers = kernel.function("__set_page_dirty_buffers") + units = "pages" + } + probe vfs.__set_page_dirty_buffers.return = +- kernel.function("__set_page_dirty_buffers").return ++ kernel.function("__set_page_dirty_buffers").return!, ++ kernel.function("block_dirty_folio") + { + name = "__set_page_dirty_buffers" + retstr = sprintf("%d", $return) +@@ -914,8 +917,9 @@ probe __vfs.ext4_mpage_readpages.return = + + + /* newer style */ ++/* add_to_page_cache_locked removed per kernel commit f00654007fe1c15 */ + probe vfs.__add_to_page_cache = +- kernel.function("add_to_page_cache_locked"), ++ kernel.function("add_to_page_cache_locked") !, + kernel.function("add_to_page_cache_lru") + { } + +@@ -939,7 +943,7 @@ probe vfs.add_to_page_cache = + + /* newer style */ + probe vfs.__add_to_page_cache.return = +- kernel.function("add_to_page_cache_locked").return, ++ kernel.function("add_to_page_cache_locked").return !, + kernel.function("add_to_page_cache_lru").return + { } + +@@ -958,7 +962,7 @@ probe vfs.add_to_page_cache.return = + + probe vfs.remove_from_page_cache = + kernel.function("__delete_from_page_cache") !, +- kernel.function("__remove_from_page_cache") ++ kernel.function("__remove_from_page_cache") ? + { + dev = __page_dev($page) + devname = __find_bdevname(dev, __page_bdev($page)) diff --git a/systemtap.spec b/systemtap.spec index 5e2ae4d..2ab4c52 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -122,7 +122,7 @@ m stapdev stapdev Name: systemtap Version: 4.8 -Release: 1%{?release_override}%{?dist} +Release: 2%{?release_override}%{?dist} # for version, see also configure.ac @@ -158,6 +158,14 @@ License: GPLv2+ URL: http://sourceware.org/systemtap/ Source: ftp://sourceware.org/pub/systemtap/releases/systemtap-%{version}.tar.gz +Patch1: rhbz1997192.patch +Patch2: rhbz2145242.patch +Patch3: rhbz2149223.patch +Patch4: rhbz2149666.patch +Patch5: rhbz2154430.patch + + + # Build* BuildRequires: make BuildRequires: gcc-c++ @@ -575,6 +583,12 @@ systemtap-runtime-virthost machine to execute systemtap scripts. %prep %setup -q +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 + %build # Enable/disable the dyninst pure-userspace backend @@ -1284,6 +1298,13 @@ exit 0 # PRERELEASE %changelog +* Fri Dec 23 2022 Frank Ch. Eigler - 4.8-2 +- rhbz2156092 = rhbz1997192 +- rhbz2145241 = rhbz2145242 +- rhbz2156093 = rhbz2149223 +- rhbz2156095 = rhbz2149666 +- rhbz2156094 = rhbz2154430 + * Thu Nov 03 2022 Frank Ch. Eigler - 4.8-1 - Upstream release.