sync bugfix form openeuler/gala-gopher pr-536

(cherry picked from commit 77bd825fa2c66af6bd1879e9edbc070a4df50140)
This commit is contained in:
xietangxin 2023-09-18 20:39:00 +08:00 committed by openeuler-sync-bot
parent fbd463ab0d
commit ba21fb1170
3 changed files with 27 additions and 74 deletions

View File

@ -1,55 +0,0 @@
From bae51740d2459bb4df647b89c8fd42a639536e7c Mon Sep 17 00:00:00 2001
From: algorithmofdish <hexiujun1@huawei.com>
Date: Fri, 15 Sep 2023 14:46:04 +0800
Subject: [PATCH] fix: syscall 'waitpid' not exist in aarch64 arch
---
.../extends/ebpf.probe/src/tprofilingprobe/syscall_sched.bpf.c | 3 ++-
src/probes/extends/ebpf.probe/src/tprofilingprobe/tprofiling.c | 2 ++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/probes/extends/ebpf.probe/src/tprofilingprobe/syscall_sched.bpf.c b/src/probes/extends/ebpf.probe/src/tprofilingprobe/syscall_sched.bpf.c
index 86b063d..daf493a 100644
--- a/src/probes/extends/ebpf.probe/src/tprofilingprobe/syscall_sched.bpf.c
+++ b/src/probes/extends/ebpf.probe/src/tprofilingprobe/syscall_sched.bpf.c
@@ -54,6 +54,7 @@ SET_SYSCALL_META(wait4)
scm->flag = SYSCALL_FLAG_STACK;
}
+#if defined(__TARGET_ARCH_x86)
SET_SYSCALL_PARAMS(waitpid) { return; }
SET_SYSCALL_META(waitpid)
@@ -61,6 +62,7 @@ SET_SYSCALL_META(waitpid)
scm->nr = SYSCALL_WAITPID_ID;
scm->flag = SYSCALL_FLAG_STACK;
}
+#endif
SET_SYSCALL_PARAMS(select) { return; }
@@ -118,7 +120,6 @@ KPROBE_SYSCALL(__arm64_sys_, sched_yield)
KPROBE_SYSCALL(__arm64_sys_, nanosleep)
KPROBE_SYSCALL(__arm64_sys_, clock_nanosleep)
KPROBE_SYSCALL(__arm64_sys_, wait4)
-KPROBE_SYSCALL(__arm64_sys_, waitpid)
KPROBE_SYSCALL(__arm64_sys_, select)
KPROBE_SYSCALL(__arm64_sys_, pselect6)
KPROBE_SYSCALL(__arm64_sys_, poll)
diff --git a/src/probes/extends/ebpf.probe/src/tprofilingprobe/tprofiling.c b/src/probes/extends/ebpf.probe/src/tprofilingprobe/tprofiling.c
index 3a19483..4402425 100644
--- a/src/probes/extends/ebpf.probe/src/tprofilingprobe/tprofiling.c
+++ b/src/probes/extends/ebpf.probe/src/tprofilingprobe/tprofiling.c
@@ -58,7 +58,9 @@ static syscall_meta_t g_syscall_metas[] = {
{SYSCALL_NANOSLEEP_ID, SYSCALL_NANOSLEEP_NAME, SYSCALL_FLAG_STACK, PROFILE_EVT_TYPE_SCHED},
{SYSCALL_CLOCK_NANOSLEEP_ID, SYSCALL_CLOCK_NANOSLEEP_NAME, SYSCALL_FLAG_STACK, PROFILE_EVT_TYPE_SCHED},
{SYSCALL_WAIT4_ID, SYSCALL_WAIT4_NAME, SYSCALL_FLAG_STACK, PROFILE_EVT_TYPE_SCHED},
+#if defined(__TARGET_ARCH_x86)
{SYSCALL_WAITPID_ID, SYSCALL_WAITPID_NAME, SYSCALL_FLAG_STACK, PROFILE_EVT_TYPE_SCHED},
+#endif
{SYSCALL_SELECT_ID, SYSCALL_SELECT_NAME, SYSCALL_FLAG_STACK, PROFILE_EVT_TYPE_SCHED},
{SYSCALL_PSELECT6_ID, SYSCALL_PSELECT6_NAME, SYSCALL_FLAG_STACK, PROFILE_EVT_TYPE_SCHED},
{SYSCALL_POLL_ID, SYSCALL_POLL_NAME, SYSCALL_FLAG_STACK, PROFILE_EVT_TYPE_SCHED},
--
2.21.0.windows.1

Binary file not shown.

View File

@ -27,7 +27,7 @@
Summary: Intelligent ops toolkit for openEuler
Name: gala-gopher
Version: 2.0.0
Release: 2
Release: 3
License: Mulan PSL v2
URL: https://gitee.com/openeuler/gala-gopher
Source: %{name}-%{version}.tar.gz
@ -35,7 +35,7 @@ BuildRoot: %{_builddir}/%{name}-%{version}
BuildRequires: systemd cmake gcc-c++ elfutils-devel clang12 llvm
BuildRequires: libconfig-devel librdkafka-devel libmicrohttpd-devel
BuildRequires: libbpf-devel >= 2:0.3 uthash-devel log4cplus-devel
BuildRequires: cjson-devel gnutls-devel
BuildRequires: cjson-devel gnutls-devel git
%if !0%{?without_flamegraph}
BuildRequires: libcurl-devel
%endif
@ -83,8 +83,6 @@ Requires: cjson conntrack-tools
Requires: lsof
%endif
Patch1: 0001-fix-syscall-waitpid-not-exist-in-aarch64-arch.patch
%description
gala-gopher is a low-overhead eBPF-based probes framework
@ -118,6 +116,14 @@ popd
%post
%systemd_post gala-gopher.service
if [ -d /var/log/gala-gopher ]; then
othermode=$(expr $(stat -L -c "%a" /var/log/gala-gopher) % 10)
if [ $othermode -ne 0 ]; then
chmod 750 /var/log/gala-gopher
chmod 750 /var/log/gala-gopher/debug
chmod 640 /var/log/gala-gopher/debug/gopher.log
fi
fi
%preun
%systemd_preun gala-gopher.service
@ -129,23 +135,25 @@ fi
%systemd_postun_with_restart gala-gopher.service
%files
%defattr(-,root,root)
%dir /opt/gala-gopher
%dir /opt/gala-gopher/extend_probes
%dir /opt/gala-gopher/meta
%dir /opt/gala-gopher/lib
%{_bindir}/*
/opt/gala-gopher/extend_probes/*
/opt/gala-gopher/meta/*
/opt/gala-gopher/lib/*
/etc/gala-gopher/res/event_multy_language.rc
%config(noreplace) /etc/gala-gopher/probes.init
%config(noreplace) /etc/gala-gopher/*.conf
%config(noreplace) /etc/gala-gopher/extend_probes/*.conf
/usr/lib/systemd/system/gala-gopher.service
%attr(0700,root,root) /usr/libexec/gala-gopher/init_probes.sh
%attr(0750,root,root) %dir /opt/gala-gopher
%attr(0550,root,root) %dir /opt/gala-gopher/extend_probes
%attr(0750,root,root) %dir /opt/gala-gopher/meta
%attr(0550,root,root) %dir /opt/gala-gopher/lib
%attr(0550,root,root) %{_bindir}/*
%attr(0550,root,root) /opt/gala-gopher/extend_probes/*
%attr(0640,root,root) /opt/gala-gopher/meta/*
%attr(0550,root,root) /opt/gala-gopher/lib/*
%attr(0640,root,root) /etc/gala-gopher/res/event_multy_language.rc
%attr(0640,root,root) %config(noreplace) /etc/gala-gopher/probes.init
%attr(0640,root,root) %config(noreplace) /etc/gala-gopher/*.conf
%attr(0640,root,root) %config(noreplace) /etc/gala-gopher/extend_probes/*.conf
%attr(0600,root,root) /usr/lib/systemd/system/gala-gopher.service
%attr(0550,root,root) /usr/libexec/gala-gopher/init_probes.sh
%changelog
* Mon Sep 18 2023 Tangxin Xie <xietangxin@huawei.com> - 2.0.0-3
- sync bugfix from openeuler/gala-gopher pr-536
* Fri Sep 15 2023 algorithmofdish <hexiujun1@huawei.com> - 2.0.0-2
- fix: syscall 'waitpid' not exist in aarch64 arch