parent
a4285cb801
commit
ec677938ab
@ -1 +1 @@
|
||||
SOURCES/systemtap-5.0.tar.gz
|
||||
SOURCES/systemtap-5.1.tar.gz
|
||||
|
@ -1 +1 @@
|
||||
f44f1853ddd462ac97b2c7c4b3a9434440d9d9c2 SOURCES/systemtap-5.0.tar.gz
|
||||
5a2a16c61e815ead31e655665e6ee9cf7772f1de SOURCES/systemtap-5.1.tar.gz
|
||||
|
@ -0,0 +1,29 @@
|
||||
commit b87891f5aff91b8ebbda8d9218009495848f7747
|
||||
Author: Martin Cermak <mcermak@redhat.com>
|
||||
Date: Thu May 16 16:51:08 2024 +0200
|
||||
|
||||
PR31495: teach stap-prep to work with other RT kernels
|
||||
|
||||
diff --git a/stap-prep b/stap-prep
|
||||
index 8b429f880..2bbb6bc2f 100755
|
||||
--- a/stap-prep
|
||||
+++ b/stap-prep
|
||||
@@ -103,13 +103,16 @@ done
|
||||
# 5.14.0-200.rt14.201.el9 ->
|
||||
# "kernel-rt-debug-5.14.0-200.rt14.201.el9"
|
||||
# OR?! "kernel-rt-5.14.0-200.rt14.201.el9"
|
||||
-if expr "$UNAME" : ".*\.rt.*" >/dev/null;
|
||||
+# OR??!"kernel-rt-5.14.0-447.el9.x86_64+rt"
|
||||
+if expr "$UNAME" : ".*\.rt.*" || expr "$UNAME" : ".*\+rt.*" >/dev/null;
|
||||
then
|
||||
KERNEL=`echo $KERNEL | sed -e s,kernel,kernel-rt,`
|
||||
fi
|
||||
|
||||
KERN_ARCH=`uname -m`
|
||||
-KERN_REV=`echo $UNAME | sed s/.$KERN_ARCH//` # strip arch from uname
|
||||
+# strip arch from uname, for kernels like 5.14.0-447.el9.x86_64+rt or
|
||||
+# 6.9.0-0.rc2.1.el10.x86_64+rt strip the +rt suffix too
|
||||
+KERN_REV=`echo $UNAME | sed s/.$KERN_ARCH// | sed s/\+rt$//`
|
||||
if [ -x /usr/bin/dnf4 ]; then
|
||||
DI="dnf4 debuginfo-install"
|
||||
DI_DEPS=""
|
@ -1,59 +0,0 @@
|
||||
commit 0fef0bd60ff4b359a32da52262855dfe82fe51ae
|
||||
gpg: Signature made Tue 14 Nov 2023 03:20:12 PM EST
|
||||
gpg: using RSA key 4B35DCD2EA45C4E0783135BC8094BE9C9F4696A1
|
||||
gpg: Can't check signature: No public key
|
||||
Author: Yichun Zhang (agentzh) <yichun@openresty.com>
|
||||
Date: Fri Nov 10 21:51:56 2023 -0800
|
||||
|
||||
PR31051: memory and uprobe leaks in early uprobe registraton code when errors happen
|
||||
|
||||
diff --git a/runtime/linux/uprobes-inode.c b/runtime/linux/uprobes-inode.c
|
||||
index 997f4528d..289cce00b 100644
|
||||
--- a/runtime/linux/uprobes-inode.c
|
||||
+++ b/runtime/linux/uprobes-inode.c
|
||||
@@ -529,6 +529,16 @@ stapiu_init(struct stapiu_consumer *consumers, size_t nconsumers)
|
||||
}
|
||||
|
||||
if (unlikely(ret != 0)) {
|
||||
+ for ( ;; ) {
|
||||
+ struct stapiu_consumer *c = &consumers[i];
|
||||
+ // protect against conceivable stapiu_refresh() at same time
|
||||
+ mutex_lock(& c->consumer_lock);
|
||||
+ stapiu_consumer_unreg(c);
|
||||
+ mutex_unlock(& c->consumer_lock);
|
||||
+ if (i == 0)
|
||||
+ break;
|
||||
+ i--;
|
||||
+ }
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -545,7 +555,27 @@ stapiu_init(struct stapiu_consumer *consumers, size_t nconsumers)
|
||||
break;
|
||||
}
|
||||
}
|
||||
- return ret;
|
||||
+
|
||||
+ if (unlikely(ret != 0)) {
|
||||
+ int j;
|
||||
+ for (j = 0; j < nconsumers; ++j) {
|
||||
+ struct stapiu_consumer *c = &consumers[j];
|
||||
+ // protect against conceivable stapiu_refresh() at same time
|
||||
+ mutex_lock(& c->consumer_lock);
|
||||
+ stapiu_consumer_unreg(c);
|
||||
+ mutex_unlock(& c->consumer_lock);
|
||||
+ }
|
||||
+ for ( ;; ) {
|
||||
+ struct stapiu_consumer *c = &consumers[i];
|
||||
+ stap_cleanup_task_finder_target(&c->finder);
|
||||
+ if (i == 0)
|
||||
+ break;
|
||||
+ i--;
|
||||
+ }
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
|
@ -1,147 +0,0 @@
|
||||
commit b84a5e8c2c5a857c0790a71df7824259a95131cf
|
||||
Author: William Cohen <wcohen@redhat.com>
|
||||
Date: Mon Dec 4 11:28:10 2023 -0500
|
||||
|
||||
PR31074: Ensure that the set_kernel_string* functions limit their writes
|
||||
|
||||
Both the set_kernel_string and set_kernel_string_n function use the
|
||||
underlying _stp_store_deref_string_ function to write strings. There
|
||||
were two issues with the this function:
|
||||
|
||||
1) wrote MAXSTRINGLEN bytes even if string was shorter
|
||||
2) null write at end could spill past end of buffer
|
||||
|
||||
The first issue was addressed by stopping to write once a null
|
||||
character is encountered. The second issue is a side effect of C
|
||||
implicit promotion of character constants to ints and was addressed by
|
||||
explicitlying casting the character constants as a char.
|
||||
|
||||
The pr31074.exp test was added to verify that the write length are
|
||||
limited to string length and the null write does not go beyond the end
|
||||
of the buffer.
|
||||
|
||||
diff --git a/runtime/linux/loc2c-runtime.h b/runtime/linux/loc2c-runtime.h
|
||||
index 68fbe2ab6..663360293 100644
|
||||
--- a/runtime/linux/loc2c-runtime.h
|
||||
+++ b/runtime/linux/loc2c-runtime.h
|
||||
@@ -1007,11 +1007,14 @@ static inline int _stp_store_deref_string_(char *src, void *addr, size_t len,
|
||||
{
|
||||
for (i = 0; i < len - 1; ++i)
|
||||
{
|
||||
+ if (*src == '\0')
|
||||
+ break;
|
||||
err = __stp_put_either(*src++, (u8 *)addr + i, seg);
|
||||
if (err)
|
||||
goto out;
|
||||
}
|
||||
- err = __stp_put_either('\0', (u8 *)addr + i, seg);
|
||||
+ /* PR31074: cast (char) '\0' to make sure right size */
|
||||
+ err = __stp_put_either((char) '\0', (u8 *)addr + i, seg);
|
||||
}
|
||||
|
||||
out:
|
||||
diff --git a/testsuite/systemtap.base/pr31074.exp b/testsuite/systemtap.base/pr31074.exp
|
||||
new file mode 100644
|
||||
index 000000000..5b382b789
|
||||
--- /dev/null
|
||||
+++ b/testsuite/systemtap.base/pr31074.exp
|
||||
@@ -0,0 +1,5 @@
|
||||
+# Check that the set_kernel_* functions work correctly.
|
||||
+
|
||||
+set test "pr31074"
|
||||
+
|
||||
+stap_run $test no_load $all_pass_string -g $srcdir/$subdir/$test.stp
|
||||
diff --git a/testsuite/systemtap.base/pr31074.stp b/testsuite/systemtap.base/pr31074.stp
|
||||
new file mode 100644
|
||||
index 000000000..930c276b5
|
||||
--- /dev/null
|
||||
+++ b/testsuite/systemtap.base/pr31074.stp
|
||||
@@ -0,0 +1,88 @@
|
||||
+/*
|
||||
+ * pr31074.stp
|
||||
+ *
|
||||
+ * Check that the set_kernel_string function work correctly.
|
||||
+ */
|
||||
+
|
||||
+probe begin { println("systemtap starting probe") }
|
||||
+probe end { println("systemtap ending probe") }
|
||||
+
|
||||
+global errors = 0
|
||||
+
|
||||
+function assert_string(test, expected, value)
|
||||
+{
|
||||
+ if (value == expected)
|
||||
+ return 1
|
||||
+ printf("systemtap test failure - %s: expected \"%s\", got \"%s\"\n",
|
||||
+ test, expected, value)
|
||||
+ errors++
|
||||
+ return 0
|
||||
+}
|
||||
+
|
||||
+function assert_not_reached(test)
|
||||
+{
|
||||
+ printf("systemtap test failure - %s: missing exception\n", test)
|
||||
+ errors++
|
||||
+}
|
||||
+
|
||||
+function assert_buffer_untouched(test, addr)
|
||||
+{
|
||||
+ if (!buffer_42(addr)) {
|
||||
+ printf("systemtap test failure - %s: buffer overwritten\n", test)
|
||||
+ errors++
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
+probe end(1)
|
||||
+{
|
||||
+ test = "set_kernel_string"
|
||||
+ addr3 = get_buffer3()
|
||||
+ addr2 = get_buffer2()
|
||||
+ if (assert_string(test, "", kernel_string(addr2))) {
|
||||
+ set_kernel_string(addr2, "bar")
|
||||
+ assert_string(test, "bar", kernel_string(addr2))
|
||||
+ }
|
||||
+ addr1 = get_buffer1()
|
||||
+ if (assert_string(test, "", kernel_string(addr1))) {
|
||||
+ set_kernel_string(addr1, "foo")
|
||||
+ assert_string(test, "foo", kernel_string(addr1))
|
||||
+ }
|
||||
+ /* now check to make sure that "bar" has not been overwritten */
|
||||
+ assert_string("no null overrun", "bar", kernel_string(addr2))
|
||||
+ assert_buffer_untouched("no overrun", addr3)
|
||||
+ if (!errors)
|
||||
+ println("systemtap test success")
|
||||
+}
|
||||
+
|
||||
+%{
|
||||
+ static char buffer_x[4+4+MAXSTRINGLEN];
|
||||
+%}
|
||||
+
|
||||
+function get_buffer1:long () %{
|
||||
+ static char *buffer1 = &(buffer_x[0]);
|
||||
+ memset(buffer1, 0, 4);
|
||||
+ STAP_RETVALUE = (long)buffer1;
|
||||
+%}
|
||||
+
|
||||
+function get_buffer2:long () %{
|
||||
+ static char *buffer2 = &(buffer_x[4]);
|
||||
+ memset(buffer2, 0, 4);
|
||||
+ STAP_RETVALUE = (long)buffer2;
|
||||
+%}
|
||||
+
|
||||
+function get_buffer3:long () %{
|
||||
+ static char *buffer3 = &(buffer_x[8]);
|
||||
+ memset(buffer3, 42, MAXSTRINGLEN);
|
||||
+ STAP_RETVALUE = (long)buffer3;
|
||||
+%}
|
||||
+
|
||||
+function buffer_42:long (addr:long) %{
|
||||
+ int i;
|
||||
+ char *buffer3 = (char *)STAP_ARG_addr;
|
||||
+ STAP_RETVALUE = 1;
|
||||
+ for(i=0; i< MAXSTRINGLEN; ++i){
|
||||
+ if (buffer3[i] != 42)
|
||||
+ STAP_RETVALUE = 0;
|
||||
+ }
|
||||
+%}
|
@ -0,0 +1,116 @@
|
||||
commit b8d4274d1e7697801c12c512b6724dd3f59f2c72
|
||||
Author: William Cohen <wcohen@redhat.com>
|
||||
Date: Mon May 6 11:36:42 2024 -0400
|
||||
|
||||
Support kernels that backported kallsym functions from newer linux kernels
|
||||
|
||||
Some Linux distributions may have backported
|
||||
module_kallsyms_on_each_symbol and kallsyms_on_each_symbol functions
|
||||
from newer linux kernels. In these situations checking the kernel
|
||||
version would not detect the proper arguments for these functions.
|
||||
Systemtap now has a couple of autoconf tests to determine what
|
||||
arguments should be used for these functions.
|
||||
|
||||
diff --git a/buildrun.cxx b/buildrun.cxx
|
||||
index bb7bdcc9d..8ee8c391f 100644
|
||||
--- a/buildrun.cxx
|
||||
+++ b/buildrun.cxx
|
||||
@@ -506,6 +506,8 @@ compile_pass (systemtap_session& s)
|
||||
|
||||
output_autoconf(s, o, cs, "autoconf-pagefault_disable.c", "STAPCONF_PAGEFAULT_DISABLE", NULL);
|
||||
output_exportconf(s, o2, "kallsyms_lookup_name", "STAPCONF_KALLSYMS_LOOKUP_NAME_EXPORTED");
|
||||
+ output_autoconf(s, o, cs, "autoconf-kallsyms_6_3.c", "STAPCONF_KALLSYMS_6_3", NULL);
|
||||
+ output_autoconf(s, o, cs, "autoconf-kallsyms_6_4.c", "STAPCONF_KALLSYMS_6_4", NULL);
|
||||
output_autoconf(s, o, cs, "autoconf-uidgid.c", "STAPCONF_LINUX_UIDGID_H", NULL);
|
||||
output_exportconf(s, o2, "sigset_from_compat", "STAPCONF_SIGSET_FROM_COMPAT_EXPORTED");
|
||||
output_exportconf(s, o2, "vzalloc", "STAPCONF_VZALLOC");
|
||||
diff --git a/runtime/linux/autoconf-kallsyms_6_3.c b/runtime/linux/autoconf-kallsyms_6_3.c
|
||||
new file mode 100644
|
||||
index 000000000..0af1a5c35
|
||||
--- /dev/null
|
||||
+++ b/runtime/linux/autoconf-kallsyms_6_3.c
|
||||
@@ -0,0 +1,6 @@
|
||||
+#include <linux/module.h>
|
||||
+
|
||||
+int module_kallsyms_on_each_symbol(const char *modname,
|
||||
+ int (*fn)(void *, const char *, struct module*,
|
||||
+ unsigned long),
|
||||
+ void *data);
|
||||
diff --git a/runtime/linux/autoconf-kallsyms_6_4.c b/runtime/linux/autoconf-kallsyms_6_4.c
|
||||
new file mode 100644
|
||||
index 000000000..3b3680c53
|
||||
--- /dev/null
|
||||
+++ b/runtime/linux/autoconf-kallsyms_6_4.c
|
||||
@@ -0,0 +1,3 @@
|
||||
+#include <linux/kallsyms.h>
|
||||
+int kallsyms_on_each_symbol(int (*fn)(void *, const char *, unsigned long),
|
||||
+ void *data);
|
||||
diff --git a/runtime/linux/kprobes.c b/runtime/linux/kprobes.c
|
||||
index 6b30f2c52..2fba61cbb 100644
|
||||
--- a/runtime/linux/kprobes.c
|
||||
+++ b/runtime/linux/kprobes.c
|
||||
@@ -737,7 +737,7 @@ __stapkp_symbol_callback(void *data, const char *name,
|
||||
}
|
||||
|
||||
static int
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,4,0)
|
||||
+#if defined(STAPCONF_KALLSYMS_6_4)
|
||||
stapkp_symbol_callback(void *data, const char *name,
|
||||
unsigned long addr)
|
||||
{
|
||||
@@ -780,7 +780,7 @@ 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)
|
||||
+#if defined(STAPCONF_KALLSYMS_6_3) || defined(STAPCONF_KALLSYMS_6_4)
|
||||
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);
|
||||
@@ -855,7 +855,7 @@ 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)
|
||||
+#if defined(STAPCONF_KALLSYMS_6_3)
|
||||
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);
|
||||
diff --git a/runtime/sym.c b/runtime/sym.c
|
||||
index 3947d42f7..23dd3be30 100644
|
||||
--- a/runtime/sym.c
|
||||
+++ b/runtime/sym.c
|
||||
@@ -1187,7 +1187,7 @@ 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)
|
||||
+#if defined(STAPCONF_KALLSYMS_6_4)
|
||||
int kallsyms_on_each_symbol(int (*fn)(void *, const char *,
|
||||
unsigned long),
|
||||
void *data)
|
||||
@@ -1214,13 +1214,13 @@ int kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module *,
|
||||
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)
|
||||
+#if defined(STAPCONF_KALLSYMS_6_4)
|
||||
int module_kallsyms_on_each_symbol(const char *modname,
|
||||
int (*fn)(void *, const char *,
|
||||
unsigned long),
|
||||
void *data)
|
||||
#else
|
||||
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,3,0)
|
||||
+#if defined(STAPCONF_KALLSYMS_6_3)
|
||||
int module_kallsyms_on_each_symbol(const char *modname,
|
||||
int (*fn)(void *, const char *, struct module *,
|
||||
unsigned long),
|
||||
@@ -1235,7 +1235,7 @@ int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *, struct module
|
||||
/* 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,3,0)
|
||||
+#if defined(STAPCONF_KALLSYMS_6_3) || defined(STAPCONF_KALLSYMS_6_4)
|
||||
return ibt_wrapper(int,
|
||||
(* (module_kallsyms_on_each_symbol_fn)_stp_module_kallsyms_on_each_symbol)(modname, fn, data));
|
||||
#else
|
@ -0,0 +1,22 @@
|
||||
commit ed5649f64a3f8c2e8269f9c4435e9174c4e8c775
|
||||
Author: William Cohen <wcohen@redhat.com>
|
||||
Date: Thu May 9 12:23:54 2024 -0400
|
||||
|
||||
Support kernels that backported kallsym functions (part 2)
|
||||
|
||||
Git commit b8d4274d1e769780 omitted a test for the Linux 6.4 version
|
||||
of kallsyms function in runtime/linux/kprobes.c.
|
||||
|
||||
diff --git a/runtime/linux/kprobes.c b/runtime/linux/kprobes.c
|
||||
index 2fba61cbb..9ae5565e3 100644
|
||||
--- a/runtime/linux/kprobes.c
|
||||
+++ b/runtime/linux/kprobes.c
|
||||
@@ -855,7 +855,7 @@ stapkp_refresh(const char *modname,
|
||||
mutex_lock(&module_mutex);
|
||||
#endif
|
||||
kallsyms_on_each_symbol(stapkp_symbol_callback, &sd);
|
||||
-#if defined(STAPCONF_KALLSYMS_6_3)
|
||||
+#if defined(STAPCONF_KALLSYMS_6_3) || defined(STAPCONF_KALLSYMS_6_4)
|
||||
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);
|
@ -0,0 +1,79 @@
|
||||
diff --git a/buildrun.cxx b/buildrun.cxx
|
||||
index a7fcd6297..e3f2f83d1 100644
|
||||
--- a/buildrun.cxx
|
||||
+++ b/buildrun.cxx
|
||||
@@ -400,6 +400,7 @@ compile_pass (systemtap_session& s)
|
||||
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_autoconf(s, o, cs, "autoconf-task_work_cancel_func.c", "STAPCONF_TASK_WORK_CANCEL_FUNC", 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",
|
||||
diff --git a/runtime/linux/autoconf-task_work_cancel_func.c b/runtime/linux/autoconf-task_work_cancel_func.c
|
||||
new file mode 100644
|
||||
index 000000000..0d460de6c
|
||||
--- /dev/null
|
||||
+++ b/runtime/linux/autoconf-task_work_cancel_func.c
|
||||
@@ -0,0 +1,3 @@
|
||||
+#include <linux/task_work.h>
|
||||
+
|
||||
+void* c = & task_work_cancel_func;
|
||||
diff --git a/runtime/linux/runtime.h b/runtime/linux/runtime.h
|
||||
index 0e9fe3fea..bd9307385 100644
|
||||
--- a/runtime/linux/runtime.h
|
||||
+++ b/runtime/linux/runtime.h
|
||||
@@ -265,7 +265,7 @@ static void *kallsyms_uprobe_get_swbp_addr;
|
||||
static void *kallsyms_task_work_add;
|
||||
#endif
|
||||
#if !defined(STAPCONF_TASK_WORK_CANCEL_EXPORTED)
|
||||
-static void *kallsyms_task_work_cancel;
|
||||
+static void *kallsyms_task_work_cancel_fn;
|
||||
#endif
|
||||
|
||||
#if !defined(STAPCONF_TRY_TO_WAKE_UP_EXPORTED) && !defined(STAPCONF_WAKE_UP_STATE_EXPORTED)
|
||||
diff --git a/runtime/stp_task_work.c b/runtime/stp_task_work.c
|
||||
index 0dd3095b6..4818fecbf 100644
|
||||
--- a/runtime/stp_task_work.c
|
||||
+++ b/runtime/stp_task_work.c
|
||||
@@ -3,14 +3,25 @@
|
||||
|
||||
#include "linux/task_work_compatibility.h"
|
||||
|
||||
+// Handle kernel commit 68cbd415dd4b9c5b9df69f0f091879e56bf5907a
|
||||
+// task_work: s/task_work_cancel()/task_work_cancel_func()/
|
||||
+#if defined(STAPCONF_TASK_WORK_CANCEL_FUNC)
|
||||
+#define TASK_WORK_CANCEL_FN task_work_cancel_func
|
||||
+#else
|
||||
+#define TASK_WORK_CANCEL_FN task_work_cancel
|
||||
+#endif
|
||||
+
|
||||
+#define STRINGIFY(x) #x
|
||||
+#define TOSTRING(x) STRINGIFY(x)
|
||||
+
|
||||
#if !defined(STAPCONF_TASK_WORK_ADD_EXPORTED)
|
||||
// First typedef from the original decls, then #define as typecasted calls.
|
||||
typedef typeof(&task_work_add) task_work_add_fn;
|
||||
#define task_work_add(a,b,c) ibt_wrapper(int, (* (task_work_add_fn)kallsyms_task_work_add)((a), (b), (c)))
|
||||
#endif
|
||||
#if !defined(STAPCONF_TASK_WORK_CANCEL_EXPORTED)
|
||||
-typedef typeof(&task_work_cancel) task_work_cancel_fn;
|
||||
-#define task_work_cancel(a,b) ibt_wrapper(struct callback_head *, (* (task_work_cancel_fn)kallsyms_task_work_cancel)((a), (b)))
|
||||
+typedef typeof(&TASK_WORK_CANCEL_FN) task_work_cancel_fn;
|
||||
+#define task_work_cancel(a,b) ibt_wrapper(struct callback_head *, (* (task_work_cancel_fn)kallsyms_task_work_cancel_fn)((a), (b)))
|
||||
#endif
|
||||
|
||||
/* To avoid a crash when a task_work callback gets called after the
|
||||
@@ -35,9 +46,9 @@ stp_task_work_init(void)
|
||||
}
|
||||
#endif
|
||||
#if !defined(STAPCONF_TASK_WORK_CANCEL_EXPORTED)
|
||||
- kallsyms_task_work_cancel = (void *)kallsyms_lookup_name("task_work_cancel");
|
||||
- if (kallsyms_task_work_cancel == NULL) {
|
||||
- _stp_error("Can't resolve task_work_cancel!");
|
||||
+ kallsyms_task_work_cancel_fn = (void *)kallsyms_lookup_name(TOSTRING(TASK_WORK_CANCEL_FN));
|
||||
+ if (kallsyms_task_work_cancel_fn == NULL) {
|
||||
+ _stp_error("Can't resolve %s!", TOSTRING(TASK_WORK_CANCEL_FN));
|
||||
return -ENOENT;
|
||||
}
|
||||
#endif
|
Loading…
Reference in new issue