fix: syscall 'waitpid' not exist in aarch64 arch

(cherry picked from commit 78573bedeaad17002f70fe6241c599ca543aec14)
This commit is contained in:
algorithmofdish 2023-09-15 15:26:48 +08:00 committed by openeuler-sync-bot
parent 3fe63f301f
commit e3b18dae67
2 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,55 @@
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

View File

@ -27,7 +27,7 @@
Summary: Intelligent ops toolkit for openEuler
Name: gala-gopher
Version: 2.0.0
Release: 1
Release: 2
License: Mulan PSL v2
URL: https://gitee.com/openeuler/gala-gopher
Source: %{name}-%{version}.tar.gz
@ -83,6 +83,8 @@ 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
@ -144,6 +146,9 @@ fi
%attr(0700,root,root) /usr/libexec/gala-gopher/init_probes.sh
%changelog
* Fri Sep 15 2023 algorithmofdish <hexiujun1@huawei.com> - 2.0.0-2
- fix: syscall 'waitpid' not exist in aarch64 arch
* Wed Aug 23 2023 Tangxin Xie <xietangxin@huawei.com> - 2.0.0-1
- update to 2.0.0