Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
William Cohen
95975d09a6 Support for linux 6.4 kernels (rhbz2230079). 2023-08-10 11:52:03 -04:00
Frank Ch. Eigler
6d9f254ab3 upstream release 2023-04-28 18:05:37 -04:00
15 changed files with 524 additions and 318 deletions

View file

@ -1,50 +0,0 @@
commit 47cab810bb7ea315a2dec23c2f61e7ba74515b82
Author: Martin Cermak <mcermak@redhat.com>
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)

View file

@ -1,30 +0,0 @@
commit 578e60102871d11ed8c18d36f6286f3a96258d8f
Author: Ryan Goldberg <rgoldber@redhat.com>
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();
}

View file

@ -1,78 +0,0 @@
commit 05eb6742c169226ae09f1737aa8b9dc1dc12adb5
Author: Mark Wielaard <mark@klomp.org>
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"

View file

@ -1,73 +0,0 @@
commit 7eed8d1fef36997b9e4c1d9cdb67643483a51e56
Author: William Cohen <wcohen@redhat.com>
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] <TASK>
[ 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] </TASK>
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();

View file

@ -1,72 +0,0 @@
commit 8f3498781413a710dc9e128f5a96891a6a18fc52
Author: Martin Cermak <mcermak@redhat.com>
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))

30
rhbz2230079.patch Normal file
View file

@ -0,0 +1,30 @@
commit ff265fa1ed86b85e021ec0f16a28ab48c237414a
Author: Yichun Zhang (agentzh) <yichun@openresty.com>
Date: Sat May 6 15:21:14 2023 -0700
PR30405: stapkp_init(): we should not disable preemption around the kallsyms_on_each_symbol() call
diff --git a/runtime/linux/kprobes.c b/runtime/linux/kprobes.c
index 09f0e0665..1875092c5 100644
--- a/runtime/linux/kprobes.c
+++ b/runtime/linux/kprobes.c
@@ -763,9 +763,7 @@ stapkp_init(struct stap_kprobe_probe *probes,
#ifdef STAPCONF_MODULE_MUTEX
mutex_lock(&module_mutex);
#endif
- preempt_disable();
kallsyms_on_each_symbol(stapkp_symbol_callback, &sd);
- preempt_enable();
#ifdef STAPCONF_MODULE_MUTEX
mutex_unlock(&module_mutex);
#endif
@@ -835,9 +833,7 @@ stapkp_refresh(const char *modname,
#ifdef STAPCONF_MODULE_MUTEX
mutex_lock(&module_mutex);
#endif
- preempt_disable();
kallsyms_on_each_symbol(stapkp_symbol_callback, &sd);
- preempt_enable();
#ifdef STAPCONF_MODULE_MUTEX
mutex_unlock(&module_mutex);
#endif

216
rhbz2230079a.patch Normal file
View file

@ -0,0 +1,216 @@
commit 33fae2d0107fb6166b4eac3fdffd277829849ab0
Author: Martin Cermak <mcermak@redhat.com>
Date: Fri Jun 2 23:28:07 2023 +0200
PR30415: conflicting types for kallsyms_on_each_symbol
diff --git a/runtime/linux/kprobes.c b/runtime/linux/kprobes.c
index 1875092c5..6b30f2c52 100644
--- a/runtime/linux/kprobes.c
+++ b/runtime/linux/kprobes.c
@@ -28,6 +28,9 @@ extern void *_stp_kallsyms_on_each_symbol;
#endif
#endif
+// No export check and gates. This one seems simply like a non-export.
+extern void *_stp_module_kallsyms_on_each_symbol;
+
#if defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL) && defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL_EXPORTED)
#define USE_KALLSYMS_ON_EACH_SYMBOL (1)
#elif defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL)
@@ -684,7 +687,7 @@ struct stapkp_symbol_data {
static int
-stapkp_symbol_callback(void *data, const char *name,
+__stapkp_symbol_callback(void *data, const char *name,
struct module *mod, unsigned long addr)
{
struct stapkp_symbol_data *sd = data;
@@ -733,6 +736,19 @@ stapkp_symbol_callback(void *data, const char *name,
return 0;
}
+static int
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0)
+stapkp_symbol_callback(void *data, const char *name,
+ unsigned long addr)
+{
+ struct module *mod = NULL;
+#else
+stapkp_symbol_callback(void *data, const char *name,
+ struct module *mod, unsigned long addr)
+{
+#endif
+ return __stapkp_symbol_callback(data, name, mod, addr);
+}
static int
stapkp_init(struct stap_kprobe_probe *probes,
@@ -764,6 +780,11 @@ stapkp_init(struct stap_kprobe_probe *probes,
mutex_lock(&module_mutex);
#endif
kallsyms_on_each_symbol(stapkp_symbol_callback, &sd);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)
+ module_kallsyms_on_each_symbol(sd.modname, stapkp_symbol_callback, &sd);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)
+ module_kallsyms_on_each_symbol(stapkp_symbol_callback, &sd);
+#endif
#ifdef STAPCONF_MODULE_MUTEX
mutex_unlock(&module_mutex);
#endif
@@ -834,6 +855,11 @@ stapkp_refresh(const char *modname,
mutex_lock(&module_mutex);
#endif
kallsyms_on_each_symbol(stapkp_symbol_callback, &sd);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)
+ module_kallsyms_on_each_symbol(sd.modname, stapkp_symbol_callback, &sd);
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)
+ module_kallsyms_on_each_symbol(stapkp_symbol_callback, &sd);
+#endif
#ifdef STAPCONF_MODULE_MUTEX
mutex_unlock(&module_mutex);
#endif
diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h
index 86d64fd0d..f7b3cdcf0 100644
--- a/runtime/linux/runtime.h
+++ b/runtime/linux/runtime.h
@@ -221,11 +221,15 @@ static void *_stp_kallsyms_lookup_name;
#ifndef CONFIG_PPC64
#define STAPCONF_KALLSYMS_ON_EACH_SYMBOL
#if !defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL_EXPORTED)
-// XXX Should not be static, since it is linked into kprobes.c.
-static void *_stp_kallsyms_on_each_symbol;
+// Not static, since it is linked into kprobes.c:
+void *_stp_kallsyms_on_each_symbol;
#endif
#endif
+// No export check and gates. This one seems simply like a non-export.
+// Not static, since it is linked into kprobes.c:
+void *_stp_module_kallsyms_on_each_symbol;
+
// PR13489, inode-uprobes sometimes lacks the necessary SYMBOL_EXPORT's.
#if !defined(STAPCONF_TASK_USER_REGSET_VIEW_EXPORTED)
static void *kallsyms_task_user_regset_view;
diff --git a/runtime/sym.c b/runtime/sym.c
index fc81ac5e8..29171b45f 100644
--- a/runtime/sym.c
+++ b/runtime/sym.c
@@ -1155,9 +1155,15 @@ unsigned long kallsyms_lookup_name (const char *name)
typedef typeof(&kallsyms_on_each_symbol) kallsyms_on_each_symbol_fn;
// XXX Will be linked in place of the kernel's kallsyms_on_each_symbol:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0)
+int kallsyms_on_each_symbol(int (*fn)(void *, const char *,
+ unsigned long),
+ void *data)
+#else
int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
unsigned long),
void *data)
+#endif
{
/* First, try to use a kallsyms_lookup_name address passed to us
through the relocation mechanism. */
@@ -1170,6 +1176,39 @@ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
_stp_error("BUG: attempting to use unavailable kallsyms_on_each_symbol!!\n");
return 0;
}
+
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,12,0)
+typedef typeof(&module_kallsyms_on_each_symbol) module_kallsyms_on_each_symbol_fn;
+
+// XXX Will be linked in place of the kernel's module_kallsyms_on_each_symbol:
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0)
+int module_kallsyms_on_each_symbol(const char *modname,
+ int (*fn)(void *, const char *,
+ unsigned long),
+ void *data)
+#else
+int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
+ unsigned long),
+ void *data)
+#endif
+{
+ /* First, try to use a kallsyms_lookup_name address passed to us
+ through the relocation mechanism. */
+ if (_stp_module_kallsyms_on_each_symbol != NULL)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0)
+ return (* (module_kallsyms_on_each_symbol_fn)_stp_module_kallsyms_on_each_symbol)(modname, fn, data);
+#else
+ return (* (module_kallsyms_on_each_symbol_fn)_stp_module_kallsyms_on_each_symbol)(fn, data);
+#endif
+
+ /* Next, give up and signal a BUG. We should have detected
+ that this function is not available and used a different
+ mechanism! */
+ _stp_error("BUG: attempting to use unavailable module_kallsyms_on_each_symbol!!\n");
+ return 0;
+}
+#endif
+
#endif
diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c
index 7f2fe0fc8..3af9a1098 100644
--- a/runtime/transport/symbols.c
+++ b/runtime/transport/symbols.c
@@ -119,6 +119,10 @@ static void _stp_do_relocation(const char __user *buf, size_t count)
_stp_kallsyms_on_each_symbol = (void *) msg.address;
}
#endif
+ if (!strcmp ("kernel", msg.module)
+ && !strcmp ("module_kallsyms_on_each_symbol", msg.reloc)) {
+ _stp_module_kallsyms_on_each_symbol = (void *) msg.address;
+ }
_stp_kmodule_update_address(msg.module, msg.reloc, msg.address);
}
diff --git a/runtime/transport/transport.c b/runtime/transport/transport.c
index 3db76badf..cf57d4286 100644
--- a/runtime/transport/transport.c
+++ b/runtime/transport/transport.c
@@ -614,6 +614,7 @@ static int _stp_transport_init(void)
#if defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL) && !defined(STAPCONF_KALLSYMS_ON_EACH_SYMBOL_EXPORTED)
_stp_kallsyms_on_each_symbol = NULL;
#endif
+ _stp_module_kallsyms_on_each_symbol = NULL;
#if defined(CONFIG_KALLSYMS) && !defined(STAPCONF_KALLSYMS_LOOKUP_NAME_EXPORTED)
_stp_need_kallsyms_stext = 0;
#endif
diff --git a/staprun/staprun.c b/staprun/staprun.c
index edd1bc67a..8437f3af6 100644
--- a/staprun/staprun.c
+++ b/staprun/staprun.c
@@ -640,6 +640,7 @@ int send_relocation_kernel ()
int found_stext = 0;
int found_kallsyms_lookup_name = 0;
int found_kallsyms_on_each_symbol = 0;
+ int found_module_kallsyms_on_each_symbol = 0;
int done_with_kallsyms = 0;
char *line = NULL;
size_t linesz = 0;
@@ -681,10 +682,20 @@ int send_relocation_kernel ()
found_kallsyms_on_each_symbol = 1;
}
+ else if (linesize - pos == sizeof "module_kallsyms_on_each_symbol"
+ && !strcmp(line + pos, "module_kallsyms_on_each_symbol" "\n"))
+ {
+ rc = send_a_relocation ("kernel", "module_kallsyms_on_each_symbol", address);
+ if (rc != 0) // non fatal, follows perror()
+ dbug(1, "Relocation was reloc module_kallsyms_on_each_symbol=%llx\n", address);
+
+ found_module_kallsyms_on_each_symbol = 1;
+ }
}
done_with_kallsyms = found_stext
&& found_kallsyms_lookup_name
- && found_kallsyms_on_each_symbol;
+ && found_kallsyms_on_each_symbol
+ && found_module_kallsyms_on_each_symbol;
}
free (line);
fclose (kallsyms);

41
rhbz2230079b.patch Normal file
View file

@ -0,0 +1,41 @@
commit 5251b3060790faafa9f94c14801baaa76a2bf8ea
Author: William Cohen <wcohen@redhat.com>
Date: Wed Jun 7 13:18:01 2023 -0400
Adjust runtime module_kallsyms_on_each_symbol to work with Linux 6.3 kernels
The recent fix for PR30415 worked for new Linux 6.4 kernels and
pre-6.3 kernels, but did not work for Linux 6.3 kernels. The Linux
6.3 kernel module_kallsyms_on_each_symbol function has both the
modname argument of the 6.4 kernels and the function passed in has the
earlier kernel's struct module pointer argument. The runtime/sym.c has
been adjusted to work with the the Linux 6.3 kernels.
diff --git a/runtime/sym.c b/runtime/sym.c
index 29171b45f..cc5c7c4dd 100644
--- a/runtime/sym.c
+++ b/runtime/sym.c
@@ -1187,15 +1187,22 @@ int module_kallsyms_on_each_symbol(const char *modname,
unsigned long),
void *data)
#else
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)
+int module_kallsyms_on_each_symbol(const char *modname,
+ int (*fn)(void *, const char *, struct module *,
+ unsigned long),
+ void *data)
+#else
int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
unsigned long),
void *data)
#endif
+#endif
{
/* First, try to use a kallsyms_lookup_name address passed to us
through the relocation mechanism. */
if (_stp_module_kallsyms_on_each_symbol != NULL)
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)
return (* (module_kallsyms_on_each_symbol_fn)_stp_module_kallsyms_on_each_symbol)(modname, fn, data);
#else
return (* (module_kallsyms_on_each_symbol_fn)_stp_module_kallsyms_on_each_symbol)(fn, data);

25
rhbz2230079c.patch Normal file
View file

@ -0,0 +1,25 @@
commit fc6519089d3f9366470ce442b648d69ed9b56f53
Author: William Cohen <wcohen@redhat.com>
Date: Wed Jun 7 21:50:34 2023 -0400
Make runtime/transport/symbols.c compatible with newer struct module_memory
The upstream kernel commit ac3b43283923440900b4f36ca5f9f0b1ca43b70e
changed the structures for modules. The runtime/transport/symbols.c
made an access to the struct module_memory and needed the appropriate
field name for the newer kernels. This change allows another dozen of
the systemtap examples to pass on Linux 6.4 kernels.
diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c
index 3af9a1098..85cbc4bab 100644
--- a/runtime/transport/symbols.c
+++ b/runtime/transport/symbols.c
@@ -390,6 +390,8 @@ static int _stp_module_update_self (void)
_stp_module_self.sections[1].static_addr = address;
#ifdef STAPCONF_MODULE_LAYOUT
_stp_module_self.sections[1].size = mod->core_layout.text_size;
+#elif STAPCONF_MODULE_MEMORY
+ _stp_module_self.sections[1].size = mod->mem[MOD_TEXT].size;
#elif defined(STAPCONF_GRSECURITY)
_stp_module_self.sections[1].size = mod->core_size_rx;
#else

26
rhbz2230079d.patch Normal file
View file

@ -0,0 +1,26 @@
commit 56054abb4efb3ef95808306b2f22339ab5c96352
Author: William Cohen <wcohen@redhat.com>
Date: Thu Jun 8 13:10:00 2023 -0400
Make runtime/transport/alloc.c compatible with newer struct module_memory
The upstream kernel commit ac3b43283923440900b4f36ca5f9f0b1ca43b70e
changed the structures for modules. The runtime/transport/alloc.c
made an access to the struct module_memory when -DSTP_MAXMEMORY is
used on the command line and needed the appropriate field name for the
newer kernels. This change allows stap script builds using
-DSTP_MAXMEMORY to work on Linux 6.4 kernels.
diff --git a/runtime/linux/alloc.c b/runtime/linux/alloc.c
index 885800d9f..9fbe8ae0a 100644
--- a/runtime/linux/alloc.c
+++ b/runtime/linux/alloc.c
@@ -271,6 +271,8 @@ static void _stp_mem_debug_validate(void *addr)
#ifdef STP_MAXMEMORY
#ifdef STAPCONF_MODULE_LAYOUT
#define _STP_MODULE_CORE_SIZE (THIS_MODULE->core_layout.size)
+#elif STAPCONF_MODULE_MEMORY
+#define _STP_MODULE_CORE_SIZE (THIS_MODULE->mem[MOD_TEXT].size)
#elif defined(STAPCONF_GRSECURITY)
#define _STP_MODULE_CORE_SIZE (THIS_MODULE->core_size_rw)
#else

37
rhbz2230079e.patch Normal file
View file

@ -0,0 +1,37 @@
commit 788c58ced532537b87f596355d3e9b6dec30e61a
Author: William Cohen <wcohen@redhat.com>
Date: Thu Jun 29 13:17:38 2023 -0400
Fedora rawhide kernels are now flagging use of zero length arrays
The kernel has switched from using zero length arrays to flexible
arrays. The kernel compiles have gotten picker and now flags accesses
beyond the end of end of arrays when possible. When trying to run the
testsuite on Fedora rawhide got the following error due to a zero
length array:
In file included from /tmp/stapaBPtwB/stap_6b7e9ee7df4a3f6e4cfbffb7f92d8405_1736_src.c:543:
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/stp_tracepoint.c: In function 'add_tracepoint':
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/stp_tracepoint.c:148:22: error: 'strcmp' reading 1 or more bytes from a region of size 0 [-Werror=stringop-overread]
148 | if (!strcmp(name, e->name)) {
| ^~~~~~~~~~~~~~~~~~~~~
/home/wcohen/systemtap_write/install/share/systemtap/runtime/linux/stp_tracepoint.c:61:14: note: source object 'name' of size 0
61 | char name[0];
| ^~~~
Switched the zero length array in the struct to a flexible array to
eliminate the issue.
diff --git a/runtime/linux/stp_tracepoint.c b/runtime/linux/stp_tracepoint.c
index 1edac313c..508948dce 100644
--- a/runtime/linux/stp_tracepoint.c
+++ b/runtime/linux/stp_tracepoint.c
@@ -58,7 +58,7 @@ struct tracepoint_entry {
struct tracepoint *tp;
int refcount;
struct list_head probes;
- char name[0];
+ char name[];
};
struct stp_tp_probe {

59
rhbz2230079f.patch Normal file
View file

@ -0,0 +1,59 @@
commit c893e0eaa4dedc90fafc9353ea00fc34ad4b6d42
Author: William Cohen <wcohen@redhat.com>
Date: Wed May 17 10:38:31 2023 -0400
Support newer kernels with struct module_memory
The upstream kernel commit ac3b43283923440900b4f36ca5f9f0b1ca43b70e
changed the structures for modules. The runtime printing of kernel
information accessed information about modules and the fields in
module structure. A test has been added to the autoconf list to
determine the appropriate fields to get information about the
module.
diff --git a/buildrun.cxx b/buildrun.cxx
index a4a254c7d..7f4ad860d 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -512,6 +512,8 @@ compile_pass (systemtap_session& s)
output_autoconf(s, o, cs, "autoconf-module_layout.c",
"STAPCONF_MODULE_LAYOUT", NULL);
+ output_autoconf(s, o, cs, "autoconf-module_memory.c",
+ "STAPCONF_MODULE_MEMORY", NULL);
output_autoconf(s, o, cs, "autoconf-mod_kallsyms.c",
"STAPCONF_MOD_KALLSYMS", NULL);
output_exportconf(s, o2, "get_user_pages_remote", "STAPCONF_GET_USER_PAGES_REMOTE");
diff --git a/runtime/linux/autoconf-module_memory.c b/runtime/linux/autoconf-module_memory.c
new file mode 100644
index 000000000..db04b8d2e
--- /dev/null
+++ b/runtime/linux/autoconf-module_memory.c
@@ -0,0 +1,3 @@
+#include <linux/module.h>
+
+struct module_memory ml;
diff --git a/runtime/linux/print.c b/runtime/linux/print.c
index 57a157986..594b155be 100644
--- a/runtime/linux/print.c
+++ b/runtime/linux/print.c
@@ -361,6 +361,11 @@ static void _stp_print_kernel_info(char *sname, char *vstr, int ctx, int num_pro
(unsigned long) (THIS_MODULE->core_layout.size - THIS_MODULE->core_layout.text_size)/1024,
(unsigned long) (THIS_MODULE->core_layout.text_size)/1024,
#else
+#if STAPCONF_MODULE_MEMORY
+ (unsigned long) THIS_MODULE->mem[MOD_TEXT].base,
+ (unsigned long) (THIS_MODULE->mem[MOD_DATA].size)/1024,
+ (unsigned long) (THIS_MODULE->mem[MOD_TEXT].size)/1024,
+#else
#ifndef STAPCONF_GRSECURITY
(unsigned long) THIS_MODULE->module_core,
(unsigned long) (THIS_MODULE->core_size - THIS_MODULE->core_text_size)/1024,
@@ -370,6 +375,7 @@ static void _stp_print_kernel_info(char *sname, char *vstr, int ctx, int num_pro
(unsigned long) (THIS_MODULE->core_size_rw - THIS_MODULE->core_size_rx)/1024,
(unsigned long) (THIS_MODULE->core_size_rx)/1024,
#endif
+#endif
#endif
ctx/1024,
_stp_allocated_net_memory/1024,

47
rhbz2230079g.patch Normal file
View file

@ -0,0 +1,47 @@
commit fabe87cb502d7990b91ed59d9773d308dfdb9a8a
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Fri Jun 30 15:56:16 2023 -0400
runtime: tweak STAPCONF_MODULE_MEMORY cpp
Correct build breakage on rhel7.
diff --git a/runtime/linux/alloc.c b/runtime/linux/alloc.c
index 9fbe8ae0a..796ad5169 100644
--- a/runtime/linux/alloc.c
+++ b/runtime/linux/alloc.c
@@ -271,7 +271,7 @@ static void _stp_mem_debug_validate(void *addr)
#ifdef STP_MAXMEMORY
#ifdef STAPCONF_MODULE_LAYOUT
#define _STP_MODULE_CORE_SIZE (THIS_MODULE->core_layout.size)
-#elif STAPCONF_MODULE_MEMORY
+#elif defined(STAPCONF_MODULE_MEMORY)
#define _STP_MODULE_CORE_SIZE (THIS_MODULE->mem[MOD_TEXT].size)
#elif defined(STAPCONF_GRSECURITY)
#define _STP_MODULE_CORE_SIZE (THIS_MODULE->core_size_rw)
diff --git a/runtime/linux/print.c b/runtime/linux/print.c
index 594b155be..db71871d2 100644
--- a/runtime/linux/print.c
+++ b/runtime/linux/print.c
@@ -361,7 +361,7 @@ static void _stp_print_kernel_info(char *sname, char *vstr, int ctx, int num_pro
(unsigned long) (THIS_MODULE->core_layout.size - THIS_MODULE->core_layout.text_size)/1024,
(unsigned long) (THIS_MODULE->core_layout.text_size)/1024,
#else
-#if STAPCONF_MODULE_MEMORY
+#ifdef STAPCONF_MODULE_MEMORY
(unsigned long) THIS_MODULE->mem[MOD_TEXT].base,
(unsigned long) (THIS_MODULE->mem[MOD_DATA].size)/1024,
(unsigned long) (THIS_MODULE->mem[MOD_TEXT].size)/1024,
diff --git a/runtime/transport/symbols.c b/runtime/transport/symbols.c
index 85cbc4bab..b5951deff 100644
--- a/runtime/transport/symbols.c
+++ b/runtime/transport/symbols.c
@@ -390,7 +390,7 @@ static int _stp_module_update_self (void)
_stp_module_self.sections[1].static_addr = address;
#ifdef STAPCONF_MODULE_LAYOUT
_stp_module_self.sections[1].size = mod->core_layout.text_size;
-#elif STAPCONF_MODULE_MEMORY
+#elif defined(STAPCONF_MODULE_MEMORY)
_stp_module_self.sections[1].size = mod->mem[MOD_TEXT].size;
#elif defined(STAPCONF_GRSECURITY)
_stp_module_self.sections[1].size = mod->core_size_rx;

View file

@ -1 +1 @@
SHA512 (systemtap-4.8.tar.gz) = fdcbc48ba17b2155c1419d99147a4cfbee2e69db945bfd0e6881b71ab11165bd23ea7ce9456856ae36807fb18f9934880a6b7c44456b63833ea260038744d9f2
SHA512 (systemtap-4.9.tar.gz) = a2736223fee0c801c36719a0245f31ed7e2e63c30bb7d5cab631dd57e4eb10e04abf2c9b272bda2a17c207c9dd163a1eb8a3e0759eda0c781946e644625510b7

View file

@ -121,8 +121,9 @@ m stapdev stapdev
Name: systemtap
Version: 4.8
Release: 3%{?release_override}%{?dist}
# PRERELEASE
Version: 4.9
Release: 2%{?release_override}%{?dist}
# for version, see also configure.ac
@ -141,6 +142,7 @@ Release: 3%{?release_override}%{?dist}
# 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
# systemtap-jupyter /usr/bin/stap-jupyter-* interactive-notebook req:systemtap
#
# Typical scenarios:
#
@ -157,13 +159,14 @@ 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: rhbz1997192.patch
Patch2: rhbz2145242.patch
Patch3: rhbz2149223.patch
Patch4: rhbz2149666.patch
Patch5: rhbz2154430.patch
Patch1: rhbz2230079.patch
Patch2: rhbz2230079a.patch
Patch3: rhbz2230079b.patch
Patch4: rhbz2230079c.patch
Patch5: rhbz2230079d.patch
Patch6: rhbz2230079e.patch
Patch7: rhbz2230079f.patch
Patch8: rhbz2230079g.patch
# Build*
@ -578,6 +581,18 @@ This package installs the services necessary on a virtual machine for a
systemtap-runtime-virthost machine to execute systemtap scripts.
%endif
%if %{with_python3} && %{with_monitor}
%package jupyter
Summary: ISystemtap jupyter kernel and examples
License: GPLv2+
URL: http://sourceware.org/systemtap/
Requires: systemtap = %{version}-%{release}
%description jupyter
This package includes files needed to build and run
the interactive systemtap Jupyter kernel, either locally
or within a container.
%endif
# ------------------------------------------------------------------------
%prep
@ -588,6 +603,9 @@ systemtap-runtime-virthost machine to execute systemtap scripts.
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%build
@ -1289,6 +1307,15 @@ exit 0
%{_sbindir}/stap-exporter
%endif
%if %{with_python3} && %{with_monitor}
%files jupyter
%{_bindir}/stap-jupyter-container
%{_bindir}/stap-jupyter-install
%{_mandir}/man1/stap-jupyter.1*
%dir %{_datadir}/systemtap
%{_datadir}/systemtap/interactive-notebook
%endif
# ------------------------------------------------------------------------
# Future new-release entries should be of the form
@ -1298,16 +1325,17 @@ exit 0
# PRERELEASE
%changelog
* Wed Feb 08 2023 Frank Ch. Eigler <fche@redhat.com> - 4.8-3
- backport several RHEL/upstream patches
* Thu Aug 10 2023 Will Cohen <wcohen@redhat.com> - 4.9-2
- Support for linux 6.4 kernels (rhbz2230079).
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Fri Apr 28 2023 Frank Ch. Eigler <fche@redhat.com> - 4.9-1
- Upstream release, see wiki page below for detailed notes.
https://sourceware.org/systemtap/wiki/SystemTapReleases
* Thu Nov 03 2022 Serhei Makarov <serhei@serhei.io> - 4.8-1
- Upstream release, see wiki page below for detailed notes.
https://sourceware.org/systemtap/wiki/SystemTapReleases
* Mon May 02 2022 Frank Ch. Eigler <fche@redhat.com> - 4.7-1
- Upstream release, see wiki page below for detailed notes.
https://sourceware.org/systemtap/wiki/SystemTapReleases