Compare commits

..

6 Commits

Author SHA1 Message Date
openeuler-ci-bot cadc2b0389 !71 Upgrade to 5.2
From: @wangxiao65 
Reviewed-by: @SuperSix173 
Signed-off-by: @SuperSix173
2024-12-17 07:41:21 +00:00
wangxiao65 4821c98fab Upgrade to 5.2 2024-12-05 12:11:00 +00:00
openeuler-ci-bot f13998008c !66 [sync] PR-61: Make stp_task_work compatible with 6.11 kernels
From: @openeuler-sync-bot 
Reviewed-by: @liqingqing_1229 
Signed-off-by: @liqingqing_1229
2024-11-05 08:03:08 +00:00
wangxiao65 7431e24c5a Make stp task work compatable with 6.11 kernels
(cherry picked from commit 608e39de48)
2024-10-20 21:44:58 +08:00
openeuler-ci-bot 5e421e85fb !54 [sync] PR-53: add loongarch64 support
From: @openeuler-sync-bot 
Reviewed-by: @SuperSix173 
Signed-off-by: @SuperSix173
2024-08-15 07:30:16 +00:00
wangqiang 28733c94fe Add basic LoongArch64 support
(cherry picked from commit db9f088765)
2024-08-15 13:48:45 +08:00
4 changed files with 9 additions and 102 deletions
@@ -1,99 +0,0 @@
From a64dc4e2e0195ca80c6509df511a42459b40e9af Mon Sep 17 00:00:00 2001
From: Martin Cermak <mcermak@redhat.com>
Date: Wed, 24 Jul 2024 16:47:42 +0200
Subject: [PATCH] Make stp_task_work compatible with 6.11 kernels
Update systemtap runtime so that it works with kernel commit
68cbd415dd4b task_work:
s/task_work_cancel()/task_work_cancel_func()/
---
buildrun.cxx | 1 +
.../linux/autoconf-task_work_cancel_func.c | 3 +++
runtime/linux/runtime.h | 2 +-
runtime/stp_task_work.c | 21 ++++++++++++++-----
4 files changed, 21 insertions(+), 6 deletions(-)
create mode 100644 runtime/linux/autoconf-task_work_cancel_func.c
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
--
2.33.0
Binary file not shown.
Binary file not shown.
+9 -3
View File
@@ -21,8 +21,8 @@
%undefine __brp_mangle_shebangs
Name: systemtap
Version: 5.0
Release: 3
Version: 5.2
Release: 1
Summary: Linux trace and probe tool
License: GPLv2+ and Public Domain
URL: http://sourceware.org/systemtap
@@ -31,7 +31,6 @@ Source: https://sourceware.org/systemtap/ftp/releases/%{name}-%{version}.tar.gz
Patch9000: huawei-fix-network-tcp-test-error.patch
Patch9001: huawei-local-is-only-valid-in-functions-for-shellche-sc2168.patch
Patch9002: Add-basic-LoongArch64-support.patch
Patch9003: Make-stp_task_work-compatible-with-6.11-kernels.patch
BuildRequires: gcc-c++ emacs systemd python3-setuptools
BuildRequires: gettext-devel rpm-devel readline-devel
@@ -277,6 +276,10 @@ install -m 644 stap-exporter/stap-exporter.8* $RPM_BUILD_ROOT%{_mandir}/man8
getent group stapusr >/dev/null || groupadd -g 156 -r stapusr 2>/dev/null || groupadd -r stapusr
getent group stapsys >/dev/null || groupadd -g 157 -r stapsys 2>/dev/null || groupadd -r stapsys
getent group stapdev >/dev/null || groupadd -g 158 -r stapdev 2>/dev/null || groupadd -r stapdev
getent group stapunpriv >/dev/null || groupadd -g 159 -r stapunpriv 2>/dev/null || groupadd -r stapunpriv
getent passwd stapunpriv >/dev/null || \
useradd -c "Systemtap Unprivileged User" -u 159 -g stapunpriv -d %{_localstatedir}/lib/stapunpriv -r -s /sbin/nologin stapunpriv 2>/dev/null || \
useradd -c "Systemtap Unprivileged User" -g stapunpriv -d %{_localstatedir}/lib/stapunpriv -r -s /sbin/nologin stapunpriv
exit 0
%pre server
@@ -479,6 +482,9 @@ exit 0
%{_mandir}/man[1378]/*
%changelog
* Thu Dec 05 2024 wangxiao <wangxiao184@h-partners.com> - 5.2-1
- Upgrade to 5.2
* Wed Sep 04 2024 wangxiao <wangxiao184@h-partners.com> - 5.0-3
- Type:bugfix
- CVE:NA