Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
f2baaa2674
!98 [sync] PR-93: strace: fix potential deadlock during cleanup
From: @openeuler-sync-bot 
Reviewed-by: @SuperSix173 
Signed-off-by: @SuperSix173
2024-12-27 10:45:29 +00:00
wangxiao65
dfef10a976 strace: fix potential deadlock during cleanup
(cherry picked from commit 2e07561f8d90586e8bbe01c909777799a50bc749)
2024-12-27 17:09:27 +08:00
openeuler-ci-bot
2dee1d1b85
!89 [sync] PR-84: remove redundant judgments
From: @openeuler-sync-bot 
Reviewed-by: @yang_yanchao 
Signed-off-by: @yang_yanchao
2024-02-28 03:56:24 +00:00
SuperSix173
cee4a21f36 remove redundant judgments
Signed-off-by: SuperSix173 <liuchao173@huawei.com>
(cherry picked from commit e70c18f03fa386a4d02cd040e2ffb08fb5111d4c)
2024-02-28 11:02:14 +08:00
openeuler-ci-bot
21f51dcf8b
!39 [sync] PR-37: 【轻量级 PR】:strace: solve ilp32 strace build error
From: @openeuler-sync-bot 
Reviewed-by: @liqingqing_1229 
Signed-off-by: @liqingqing_1229
2023-04-05 08:28:53 +00:00
ChenZanYu
f0f199c239 When constructing, HAVE_ARCH_OLD_TIME64_SYSCALLS SIZEOF_LONG == 8,
resulting in failure to build ilp32, need to add SIZEOF_LONG == 4 to fit ilp32

Signed-off-by: ChenZanYu <chenzanyu@huawei.com>
(cherry picked from commit 066cdae692ccbf1d1bdbdcf27acd1d68c6ebb3ad)
2023-04-05 16:28:26 +08:00
openeuler-ci-bot
388b19cdbf
!29 [sync] PR-28: Add support for loongarch64
From: @openeuler-sync-bot 
Reviewed-by: @liqingqing_1229 
Signed-off-by: @liqingqing_1229
2023-01-12 07:13:05 +00:00
Hui Li
148826cb1e Add support for loongarch64
Signed-off-by: Hui Li <lihui@loongson.cn>
(cherry picked from commit 4db4362c6bfeb4ef0bb62e43c2b7701458d0ce4e)
2023-01-12 15:12:21 +08:00
openeuler-ci-bot
1890513301
!27 [sync] PR-26: 添加sw架构
From: @openeuler-sync-bot 
Reviewed-by: @liqingqing_1229 
Signed-off-by: @liqingqing_1229
2022-11-03 11:45:43 +00:00
wzx
6f19c26d74 Add sw64 architecture
Signed-off-by: wzx <wuzx1226@qq.com>
(cherry picked from commit f988fd04584e135b14472d0a0b79c8d1b34bb7be)
2022-11-03 19:44:23 +08:00
9 changed files with 4553 additions and 13 deletions

View File

@ -0,0 +1,91 @@
From 651640fd5faf0e24d9cd88c596854c108f732329 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Fri, 24 Nov 2023 08:00:00 +0000
Subject: [PATCH] Move print_debug_info() definition before cleanup()
* src/strace.c (print_debug_info): Move before cleanup().
Reference: https://github.com/strace/strace/commit/651640fd5faf0e24d9cd88c596854c108f732329
Conflict: Since the current version has not merged commits 462fa296 and d0e007f6,
based on the current version, move print_debug_info() definition before cleanup().
---
src/strace.c | 56 ++++++++++++++++++++++++++--------------------------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/src/strace.c b/src/strace.c
index d3fa44f30..28f5b4368 100644
--- a/src/strace.c
+++ b/src/strace.c
@@ -2779,34 +2779,6 @@ pid2tcb(const int pid)
}
static void
-cleanup(int fatal_sig)
-{
- unsigned int i;
- struct tcb *tcp;
-
- if (!fatal_sig)
- fatal_sig = SIGTERM;
-
- for (i = 0; i < tcbtabsize; i++) {
- tcp = tcbtab[i];
- if (!tcp->pid)
- continue;
- debug_func_msg("looking at pid %u", tcp->pid);
- if (tcp->pid == strace_child) {
- kill(tcp->pid, SIGCONT);
- kill(tcp->pid, fatal_sig);
- }
- detach(tcp);
- }
-}
-
-static void
-interrupt(int sig)
-{
- interrupted = sig;
-}
-
-static void
print_debug_info(const int pid, int status)
{
const unsigned int event = (unsigned int) status >> 16;
@@ -2845,6 +2817,34 @@ print_debug_info(const int pid, int stat
error_msg("[wait(0x%06x) = %u] %s%s", status, pid, buf, evbuf);
}
+static void
+cleanup(int fatal_sig)
+{
+ unsigned int i;
+ struct tcb *tcp;
+
+ if (!fatal_sig)
+ fatal_sig = SIGTERM;
+
+ for (i = 0; i < tcbtabsize; i++) {
+ tcp = tcbtab[i];
+ if (!tcp->pid)
+ continue;
+ debug_func_msg("looking at pid %u", tcp->pid);
+ if (tcp->pid == strace_child) {
+ kill(tcp->pid, SIGCONT);
+ kill(tcp->pid, fatal_sig);
+ }
+ detach(tcp);
+ }
+}
+
+static void
+interrupt(int sig)
+{
+ interrupted = sig;
+}
+
static struct tcb *
maybe_allocate_tcb(const int pid, int status)
{
--
2.33.0

View File

@ -0,0 +1,51 @@
From 83a2af722ce2c2b38f3d6d9f4114015521449a2a Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Sat, 25 Nov 2023 08:00:00 +0000
Subject: [PATCH] Factor out droptcb_verbose() from detach()
* src/strace.c (droptcb_verbose): New function.
(detach): Use it instead of droptcb.
Reference: https://github.com/strace/strace/commit/83a2af722ce2c2b38f3d6d9f4114015521449a2a
Conflict: NA
---
src/strace.c | 16 +++++++++++-----
1 file changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/strace.c b/src/strace.c
index 28f5b4368..351842792 100644
--- a/src/strace.c
+++ b/src/strace.c
@@ -1148,6 +1148,16 @@ droptcb(struct tcb *tcp)
memset(tcp, 0, sizeof(*tcp));
}
+static void
+droptcb_verbose(struct tcb *tcp)
+{
+ if (!is_number_in_set(QUIET_ATTACH, quiet_set)
+ && (tcp->flags & TCB_ATTACHED))
+ error_msg("Process %u detached", tcp->pid);
+
+ droptcb(tcp);
+}
+
/* Detach traced process.
* Never call DETACH twice on the same process as both unattached and
* attached-unstopped processes give the same ESRCH. For unattached process we
@@ -1302,11 +1312,7 @@ detach(struct tcb *tcp)
}
drop:
- if (!is_number_in_set(QUIET_ATTACH, quiet_set)
- && (tcp->flags & TCB_ATTACHED))
- error_msg("Process %u detached", tcp->pid);
-
- droptcb(tcp);
+ droptcb_verbose(tcp);
}
static void
--
2.33.0

View File

@ -0,0 +1,127 @@
From 4c4c339585b523167e336d9b379fe4c00dc94dca Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Sun, 26 Nov 2023 08:00:00 +0000
Subject: [PATCH] Factor out interrupt_or_stop() from detach()
* src/strace.c (interrupt_or_stop): New function.
(detach): Use it.
Reference: https://github.com/strace/strace/commit/4c4c339585b523167e336d9b379fe4c00dc94dca
Conflict: NA
---
src/strace.c | 49 ++++++++++++++++++++++++++++---------------------
1 file changed, 28 insertions(+), 21 deletions(-)
diff --git a/src/strace.c b/src/strace.c
index 351842792..385cbaa72 100644
--- a/src/strace.c
+++ b/src/strace.c
@@ -1158,17 +1158,10 @@ droptcb_verbose(struct tcb *tcp)
droptcb(tcp);
}
-/* Detach traced process.
- * Never call DETACH twice on the same process as both unattached and
- * attached-unstopped processes give the same ESRCH. For unattached process we
- * would SIGSTOP it and wait for its SIGSTOP notification forever.
- */
-static void
-detach(struct tcb *tcp)
+/* Returns true when the tracee has to be waited for. */
+static bool
+interrupt_or_stop(struct tcb *tcp)
{
- int error;
- int status;
-
/*
* Linux wrongly insists the child be stopped
* before detaching. Arghh. We go through hoops
@@ -1176,24 +1169,24 @@ detach(struct tcb *tcp)
*/
if (!(tcp->flags & TCB_ATTACHED))
- goto drop;
+ return false;
/* We attached but possibly didn't see the expected SIGSTOP.
* We must catch exactly one as otherwise the detached process
* would be left stopped (process state T).
*/
if (tcp->flags & TCB_IGNORE_ONE_SIGSTOP)
- goto wait_loop;
+ return true;
- error = ptrace(PTRACE_DETACH, tcp->pid, 0, 0);
+ int error = ptrace(PTRACE_DETACH, tcp->pid, 0, 0);
if (!error) {
/* On a clear day, you can see forever. */
- goto drop;
+ return false;
}
if (errno != ESRCH) {
/* Shouldn't happen. */
perror_func_msg("ptrace(PTRACE_DETACH,%u)", tcp->pid);
- goto drop;
+ return false;
}
/* ESRCH: process is either not stopped or doesn't exist. */
if (my_tkill(tcp->pid, 0) < 0) {
@@ -1201,7 +1194,7 @@ detach(struct tcb *tcp)
/* Shouldn't happen. */
perror_func_msg("tkill(%u,0)", tcp->pid);
/* else: process doesn't exist. */
- goto drop;
+ return false;
}
/* Process is not stopped, need to stop it. */
if (use_seize) {
@@ -1213,26 +1206,40 @@ detach(struct tcb *tcp)
*/
error = ptrace(PTRACE_INTERRUPT, tcp->pid, 0, 0);
if (!error)
- goto wait_loop;
+ return true;
if (errno != ESRCH)
perror_func_msg("ptrace(PTRACE_INTERRUPT,%u)", tcp->pid);
} else {
error = my_tkill(tcp->pid, SIGSTOP);
if (!error)
- goto wait_loop;
+ return true;
if (errno != ESRCH)
perror_func_msg("tkill(%u,SIGSTOP)", tcp->pid);
}
+
/* Either process doesn't exist, or some weird error. */
- goto drop;
+ return false;
+}
- wait_loop:
- /* We end up here in three cases:
+/* Detach traced process.
+ * Never call DETACH twice on the same process as both unattached and
+ * attached-unstopped processes give the same ESRCH. For unattached process we
+ * would SIGSTOP it and wait for its SIGSTOP notification forever.
+ */
+static void
+detach(struct tcb *tcp)
+{
+ if (!interrupt_or_stop(tcp))
+ goto drop;
+
+ /*
+ * We end up here in three cases:
* 1. We sent PTRACE_INTERRUPT (use_seize case)
* 2. We sent SIGSTOP (!use_seize)
* 3. Attach SIGSTOP was already pending (TCB_IGNORE_ONE_SIGSTOP set)
*/
for (;;) {
+ int status;
unsigned int sig;
if (waitpid(tcp->pid, &status, __WALL) < 0) {
if (errno == EINTR)
--
2.33.0

View File

@ -0,0 +1,179 @@
From d275fc0312255ddffa878b70da34d945b4fd8212 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Mon, 27 Nov 2023 08:00:00 +0000
Subject: [PATCH] Factor out detach_interrupted_or_stopped() from detach()
* src/strace.c (detach_interrupted_or_stopped): New function.
(detach): Use it.
Reference: https://github.com/strace/strace/commit/d275fc0312255ddffa878b70da34d945b4fd8212
Conflict: NA
---
src/strace.c | 136 +++++++++++++++++++++++++++------------------------
1 file changed, 72 insertions(+), 64 deletions(-)
diff --git a/src/strace.c b/src/strace.c
index 385cbaa72..ef3360b95 100644
--- a/src/strace.c
+++ b/src/strace.c
@@ -1221,6 +1221,77 @@ interrupt_or_stop(struct tcb *tcp)
return false;
}
+/* Returns true if the tracee can be passed to droptcb. */
+static bool
+detach_interrupted_or_stopped(struct tcb *tcp, int status)
+{
+ if (!WIFSTOPPED(status)) {
+ /*
+ * Tracee exited or was killed by signal.
+ * We shouldn't normally reach this place:
+ * we don't want to consume exit status.
+ * Consider "strace -p PID" being ^C-ed:
+ * we want merely to detach from PID.
+ *
+ * However, we _can_ end up here if tracee
+ * was SIGKILLed.
+ */
+ return true;
+ }
+ unsigned int sig = WSTOPSIG(status);
+ debug_msg("detach wait: event:%d sig:%d",
+ (unsigned) status >> 16, sig);
+ if (use_seize) {
+ unsigned event = (unsigned)status >> 16;
+ if (event == PTRACE_EVENT_STOP /*&& sig == SIGTRAP*/) {
+ /*
+ * sig == SIGTRAP: PTRACE_INTERRUPT stop.
+ * sig == other: process was already stopped
+ * with this stopping sig (see tests/detach-stopped).
+ * Looks like re-injecting this sig is not necessary
+ * in DETACH for the tracee to remain stopped.
+ */
+ sig = 0;
+ }
+ /*
+ * PTRACE_INTERRUPT is not guaranteed to produce
+ * the above event if other ptrace-stop is pending.
+ * See tests/detach-sleeping testcase:
+ * strace got SIGINT while tracee is sleeping.
+ * We sent PTRACE_INTERRUPT.
+ * We see syscall exit, not PTRACE_INTERRUPT stop.
+ * We won't get PTRACE_INTERRUPT stop
+ * if we would CONT now. Need to DETACH.
+ */
+ if (sig == syscall_trap_sig)
+ sig = 0;
+ /* else: not sure in which case we can be here.
+ * Signal stop? Inject it while detaching.
+ */
+ ptrace_restart(PTRACE_DETACH, tcp, sig);
+ return true;
+ }
+ /* Note: this check has to be after use_seize check */
+ /* (else, in use_seize case SIGSTOP will be mistreated) */
+ if (sig == SIGSTOP) {
+ /* Detach, suppressing SIGSTOP */
+ ptrace_restart(PTRACE_DETACH, tcp, 0);
+ return true;
+ }
+ if (sig == syscall_trap_sig)
+ sig = 0;
+ /* Can't detach just yet, may need to wait for SIGSTOP */
+ int error = ptrace_restart(PTRACE_CONT, tcp, sig);
+ if (error < 0) {
+ /* Should not happen.
+ * Note: ptrace_restart returns 0 on ESRCH, so it's not it.
+ * ptrace_restart already emitted error message.
+ */
+ return true;
+ }
+ return false;
+}
+
/* Detach traced process.
* Never call DETACH twice on the same process as both unattached and
* attached-unstopped processes give the same ESRCH. For unattached process we
@@ -1240,7 +1311,6 @@ detach(struct tcb *tcp)
*/
for (;;) {
int status;
- unsigned int sig;
if (waitpid(tcp->pid, &status, __WALL) < 0) {
if (errno == EINTR)
continue;
@@ -1252,70 +1322,8 @@ detach(struct tcb *tcp)
perror_func_msg("waitpid(%u)", tcp->pid);
break;
}
- if (!WIFSTOPPED(status)) {
- /*
- * Tracee exited or was killed by signal.
- * We shouldn't normally reach this place:
- * we don't want to consume exit status.
- * Consider "strace -p PID" being ^C-ed:
- * we want merely to detach from PID.
- *
- * However, we _can_ end up here if tracee
- * was SIGKILLed.
- */
- break;
- }
- sig = WSTOPSIG(status);
- debug_msg("detach wait: event:%d sig:%d",
- (unsigned) status >> 16, sig);
- if (use_seize) {
- unsigned event = (unsigned)status >> 16;
- if (event == PTRACE_EVENT_STOP /*&& sig == SIGTRAP*/) {
- /*
- * sig == SIGTRAP: PTRACE_INTERRUPT stop.
- * sig == other: process was already stopped
- * with this stopping sig (see tests/detach-stopped).
- * Looks like re-injecting this sig is not necessary
- * in DETACH for the tracee to remain stopped.
- */
- sig = 0;
- }
- /*
- * PTRACE_INTERRUPT is not guaranteed to produce
- * the above event if other ptrace-stop is pending.
- * See tests/detach-sleeping testcase:
- * strace got SIGINT while tracee is sleeping.
- * We sent PTRACE_INTERRUPT.
- * We see syscall exit, not PTRACE_INTERRUPT stop.
- * We won't get PTRACE_INTERRUPT stop
- * if we would CONT now. Need to DETACH.
- */
- if (sig == syscall_trap_sig)
- sig = 0;
- /* else: not sure in which case we can be here.
- * Signal stop? Inject it while detaching.
- */
- ptrace_restart(PTRACE_DETACH, tcp, sig);
- break;
- }
- /* Note: this check has to be after use_seize check */
- /* (else, in use_seize case SIGSTOP will be mistreated) */
- if (sig == SIGSTOP) {
- /* Detach, suppressing SIGSTOP */
- ptrace_restart(PTRACE_DETACH, tcp, 0);
+ if (detach_interrupted_or_stopped(tcp, status))
break;
- }
- if (sig == syscall_trap_sig)
- sig = 0;
- /* Can't detach just yet, may need to wait for SIGSTOP */
- error = ptrace_restart(PTRACE_CONT, tcp, sig);
- if (error < 0) {
- /* Should not happen.
- * Note: ptrace_restart returns 0 on ESRCH, so it's not it.
- * ptrace_restart already emitted error message.
- */
- break;
- }
}
drop:
--
2.33.0

View File

@ -0,0 +1,118 @@
From 3cfa90b54367168cc1e473af004675f12816e955 Mon Sep 17 00:00:00 2001
From: donghaobo <donghaobo@kuaishou.com>
Date: Fri, 17 Nov 2023 13:55:22 +0800
Subject: [PATCH] strace: fix potential deadlock during cleanup
strace -f can potentially deadlock during cleanup if the tracee
is using vfork or CLONE_VFORK to spawn threads.
On linux, calling vfork will cause the calling thread to 'D' state
until the child process calls execve or exit. Therefore, strace
should detach the child process first, otherwise it can wait
indefinitely for the calling thread in 'D' state.
Reproducer:
/*
* Start tracing with strace -f,
* then press Ctrl-C within 9 seconds to interrupt.
*/
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
int main(void)
{
pid_t pid = vfork();
if (pid < 0)
return 1;
if (pid) {
int status;
waitpid(pid, &status, 0);
return 0;
}
sleep(9);
_exit(0);
}
* src/strace.c (cleanup): Do not call detach() for each tracee
one by one as it can deadlock, instead call interrupt_or_stop()
for each tracee and after that enter a wait loop calling
detach_interrupted_or_stopped() for each tracee as soon as
they become ready.
* NEWS: Mention this fix.
Co-authored-by: Dmitry V. Levin <ldv@strace.io>
Reference: https://github.com/strace/strace/commit/3cfa90b54367168cc1e473af004675f12816e955
Conflict: Remove NEWS, src/strace.c adapt patch context
---
NEWS | 2 ++
src/strace.c | 45 ++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/src/strace.c b/src/strace.c
index ef3360b95..04b3c1dfe 100644
--- a/src/strace.c
+++ b/src/strace.c
@@ -2847,6 +2847,8 @@ cleanup(int fatal_sig)
if (!fatal_sig)
fatal_sig = SIGTERM;
+ size_t num_to_wait = 0;
+
for (i = 0; i < tcbtabsize; i++) {
tcp = tcbtab[i];
if (!tcp->pid)
@@ -3177,7 +3179,48 @@ cleanup(int fatal_sig)
kill(tcp->pid, SIGCONT);
kill(tcp->pid, fatal_sig);
}
- detach(tcp);
+ if (interrupt_or_stop(tcp))
+ ++num_to_wait;
+ else
+ droptcb_verbose(tcp);
+ }
+
+ while (num_to_wait) {
+ int status;
+ pid_t pid = waitpid(-1, &status, __WALL);
+
+ if (pid < 0) {
+ if (errno == EINTR)
+ continue;
+ /* ECHILD is not expected */
+ perror_func_msg("waitpid(-1, __WALL)");
+ break;
+ }
+
+ if (pid == popen_pid) {
+ if (!WIFSTOPPED(status))
+ popen_pid = 0;
+ continue;
+ }
+
+ if (debug_flag)
+ print_debug_info(pid, status);
+
+ struct tcb *tcp = pid2tcb(pid);
+ if (!tcp) {
+ if (!is_number_in_set(QUIET_EXIT, quiet_set)) {
+ /*
+ * This can happen if we inherited an unknown child.
+ */
+ error_msg("Exit of unknown pid %u ignored", pid);
+ }
+ continue;
+ }
+
+ if (detach_interrupted_or_stopped(tcp, status)) {
+ droptcb_verbose(tcp);
+ --num_to_wait;
+ }
}
}
--
2.33.0

View File

@ -0,0 +1,600 @@
From da451baee5e701949fd570904998d456c8bdc744 Mon Sep 17 00:00:00 2001
From: Hui Li <lihui@loongson.cn>
Date: Tue, 10 Jan 2023 06:13:10 +0800
Subject: [PATCH 1/2] Add support for 64-bit LoongArch architecture
Signed-off-by: Hui Li <lihui@loongson.cn>
---
NEWS | 1 +
configure | 7 +++
configure.ac | 5 ++
src/Makefile.am | 15 +++++
src/linux/loongarch64/arch_defs_.h | 8 +++
src/linux/loongarch64/arch_fpregset.c | 36 +++++++++++
src/linux/loongarch64/arch_fpregset.h | 15 +++++
src/linux/loongarch64/arch_prstatus_regset.c | 49 +++++++++++++++
src/linux/loongarch64/arch_prstatus_regset.h | 15 +++++
src/linux/loongarch64/arch_regs.c | 11 ++++
src/linux/loongarch64/get_error.c | 19 ++++++
src/linux/loongarch64/get_scno.c | 14 +++++
src/linux/loongarch64/get_syscall_args.c | 19 ++++++
src/linux/loongarch64/ioctls_arch0.h | 1 +
src/linux/loongarch64/ioctls_inc0.h | 1 +
src/linux/loongarch64/raw_syscall.h | 29 +++++++++
src/linux/loongarch64/set_error.c | 20 ++++++
src/linux/loongarch64/set_scno.c | 15 +++++
src/linux/loongarch64/syscallent.h | 8 +++
src/xlat/audit_arch.in | 2 +
src/xlat/elf_em.in | 1 +
tests/ptrace.c | 65 +++++++++++++++++++-
22 files changed, 355 insertions(+), 1 deletion(-)
create mode 100644 src/linux/loongarch64/arch_defs_.h
create mode 100644 src/linux/loongarch64/arch_fpregset.c
create mode 100644 src/linux/loongarch64/arch_fpregset.h
create mode 100644 src/linux/loongarch64/arch_prstatus_regset.c
create mode 100644 src/linux/loongarch64/arch_prstatus_regset.h
create mode 100644 src/linux/loongarch64/arch_regs.c
create mode 100644 src/linux/loongarch64/get_error.c
create mode 100644 src/linux/loongarch64/get_scno.c
create mode 100644 src/linux/loongarch64/get_syscall_args.c
create mode 100644 src/linux/loongarch64/ioctls_arch0.h
create mode 100644 src/linux/loongarch64/ioctls_inc0.h
create mode 100644 src/linux/loongarch64/raw_syscall.h
create mode 100644 src/linux/loongarch64/set_error.c
create mode 100644 src/linux/loongarch64/set_scno.c
create mode 100644 src/linux/loongarch64/syscallent.h
diff --git a/NEWS b/NEWS
index f88de1d..d6727a4 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Noteworthy changes in release 5.14 (2021-09-02)
* Updated lists of BPF_*, IORING_*, MADV_*, MOUNT_ATTR_*, SCTP_*,
and UFFD_* constants.
* Updated lists of ioctl commands from Linux 5.14.
+ * Added 64-bit LoongArch architecture support.
* Bug fixes
* Fixed build using bionic libc.
diff --git a/configure b/configure
index f19e397..88cd0b9 100755
--- a/configure
+++ b/configure
@@ -6049,6 +6049,13 @@ ia64)
$as_echo "#define IA64 1" >>confdefs.h
+ ;;
+loongarch64)
+ arch=loongarch64
+ karch=loongarch
+
+$as_echo "#define LOONGARCH64 1" >>confdefs.h
+
;;
m68k)
arch=m68k
diff --git a/configure.ac b/configure.ac
index 2771c0f..def3bb2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -110,6 +110,11 @@ ia64)
arch=ia64
AC_DEFINE([IA64], 1, [Define for the IA64 architecture.])
;;
+loongarch64)
+ arch=loongarch64
+ karch=loongarch
+ AC_DEFINE([LOONGARCH64], 1, [Define for the 64-bit LoongArch architecture.])
+ ;;
m68k)
arch=m68k
AC_DEFINE([M68K], 1, [Define for the m68k architecture.])
diff --git a/src/Makefile.am b/src/Makefile.am
index b7e74a7..dc38851 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -634,6 +634,21 @@ EXTRA_DIST = \
linux/ia64/syscallent.h \
linux/ia64/syscallent_base_nr.h \
linux/ia64/userent.h \
+ linux/loongarch64/arch_defs_.h \
+ linux/loongarch64/arch_fpregset.c \
+ linux/loongarch64/arch_fpregset.h \
+ linux/loongarch64/arch_prstatus_regset.c \
+ linux/loongarch64/arch_prstatus_regset.h \
+ linux/loongarch64/arch_regs.c \
+ linux/loongarch64/get_error.c \
+ linux/loongarch64/get_scno.c \
+ linux/loongarch64/get_syscall_args.c \
+ linux/loongarch64/ioctls_arch0.h \
+ linux/loongarch64/ioctls_inc0.h \
+ linux/loongarch64/raw_syscall.h \
+ linux/loongarch64/set_error.c \
+ linux/loongarch64/set_scno.c \
+ linux/loongarch64/syscallent.h \
linux/m68k/arch_defs_.h \
linux/m68k/arch_regs.c \
linux/m68k/arch_rt_sigframe.c \
diff --git a/src/linux/loongarch64/arch_defs_.h b/src/linux/loongarch64/arch_defs_.h
new file mode 100644
index 0000000..ffb5733
--- /dev/null
+++ b/src/linux/loongarch64/arch_defs_.h
@@ -0,0 +1,8 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#define PERSONALITY0_AUDIT_ARCH { AUDIT_ARCH_LOONGARCH64, 0 }
diff --git a/src/linux/loongarch64/arch_fpregset.c b/src/linux/loongarch64/arch_fpregset.c
new file mode 100644
index 0000000..b17a407
--- /dev/null
+++ b/src/linux/loongarch64/arch_fpregset.c
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+static void
+arch_decode_fpregset(struct tcb *const tcp,
+ const kernel_ulong_t addr,
+ const kernel_ulong_t size)
+{
+ struct_fpregset regs;
+ const size_t fetch_size = MIN(sizeof(regs), size);
+
+ if (!size || size & 7) {
+ printaddr(addr);
+ } else if (!umoven_or_printaddr(tcp, addr, fetch_size, &regs)) {
+ tprint_struct_begin();
+ PRINT_FIELD_ARRAY_UPTO(regs, fpr, fetch_size / 8, tcp,
+ print_xint64_array_member);
+ if (fetch_size > offsetof(struct_fpregset, fcc)) {
+ tprint_struct_next();
+ PRINT_FIELD_X(regs, fcc);
+ }
+ if (fetch_size > offsetof(struct_fpregset, fcsr)) {
+ tprint_struct_next();
+ PRINT_FIELD_X(regs, fcsr);
+ }
+ if (size > sizeof(regs)) {
+ tprint_struct_next();
+ tprint_more_data_follows();
+ }
+ tprint_struct_end();
+ }
+}
diff --git a/src/linux/loongarch64/arch_fpregset.h b/src/linux/loongarch64/arch_fpregset.h
new file mode 100644
index 0000000..998b40f
--- /dev/null
+++ b/src/linux/loongarch64/arch_fpregset.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef STRACE_ARCH_FPREGSET_H
+# define STRACE_ARCH_FPREGSET_H
+
+typedef struct user_fp_state struct_fpregset;
+
+# define HAVE_ARCH_FPREGSET 1
+
+#endif /* !STRACE_ARCH_FPREGSET_H */
diff --git a/src/linux/loongarch64/arch_prstatus_regset.c b/src/linux/loongarch64/arch_prstatus_regset.c
new file mode 100644
index 0000000..f5a0c57
--- /dev/null
+++ b/src/linux/loongarch64/arch_prstatus_regset.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+static void
+arch_decode_prstatus_regset(struct tcb *const tcp,
+ const kernel_ulong_t addr,
+ const kernel_ulong_t size)
+{
+ struct_prstatus_regset regs;
+ const size_t fetch_size = MIN(sizeof(regs), size);
+
+ if (!size || size & 7) {
+ printaddr(addr);
+ } else if (!umoven_or_printaddr(tcp, addr, fetch_size, &regs)) {
+ tprint_struct_begin();
+ PRINT_FIELD_ARRAY_UPTO(regs, regs,
+ fetch_size / 8, tcp,
+ print_xint64_array_member);
+ if (fetch_size > offsetof(struct_prstatus_regset, orig_a0)) {
+ tprint_struct_next();
+ PRINT_FIELD_X(regs, orig_a0);
+ }
+ if (fetch_size > offsetof(struct_prstatus_regset, csr_era)) {
+ tprint_struct_next();
+ PRINT_FIELD_X(regs, csr_era);
+ }
+ if (fetch_size > offsetof(struct_prstatus_regset, csr_badv)) {
+ tprint_struct_next();
+ PRINT_FIELD_X(regs, csr_badv);
+ }
+ const size_t offset_of_reserved =
+ offsetof(struct_prstatus_regset, reserved);
+ if (fetch_size > offset_of_reserved) {
+ tprint_struct_next();
+ PRINT_FIELD_ARRAY_UPTO(regs, reserved,
+ (fetch_size - offset_of_reserved) / 8,
+ tcp, print_xint64_array_member);
+ }
+ if (size > sizeof(regs)) {
+ tprint_struct_next();
+ tprint_more_data_follows();
+ }
+ tprint_struct_end();
+ }
+}
diff --git a/src/linux/loongarch64/arch_prstatus_regset.h b/src/linux/loongarch64/arch_prstatus_regset.h
new file mode 100644
index 0000000..e7eb64b
--- /dev/null
+++ b/src/linux/loongarch64/arch_prstatus_regset.h
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef STRACE_ARCH_PRSTATUS_REGSET_H
+# define STRACE_ARCH_PRSTATUS_REGSET_H
+
+typedef struct user_pt_regs struct_prstatus_regset;
+
+# define HAVE_ARCH_PRSTATUS_REGSET 1
+
+#endif /* !STRACE_ARCH_PRSTATUS_REGSET_H */
diff --git a/src/linux/loongarch64/arch_regs.c b/src/linux/loongarch64/arch_regs.c
new file mode 100644
index 0000000..509ac8e
--- /dev/null
+++ b/src/linux/loongarch64/arch_regs.c
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+static struct user_pt_regs loongarch_regs;
+#define ARCH_REGS_FOR_GETREGSET loongarch_regs
+#define ARCH_PC_REG loongarch_regs.csr_era
+#define ARCH_SP_REG loongarch_regs.regs[3]
diff --git a/src/linux/loongarch64/get_error.c b/src/linux/loongarch64/get_error.c
new file mode 100644
index 0000000..b52ae28
--- /dev/null
+++ b/src/linux/loongarch64/get_error.c
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "negated_errno.h"
+
+static void
+arch_get_error(struct tcb *tcp, const bool check_errno)
+{
+ if (check_errno && is_negated_errno(loongarch_regs.regs[4])) {
+ tcp->u_rval = -1;
+ tcp->u_error = -loongarch_regs.regs[4];
+ } else {
+ tcp->u_rval = loongarch_regs.regs[4];
+ }
+}
diff --git a/src/linux/loongarch64/get_scno.c b/src/linux/loongarch64/get_scno.c
new file mode 100644
index 0000000..cb0f42c
--- /dev/null
+++ b/src/linux/loongarch64/get_scno.c
@@ -0,0 +1,14 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+/* Return codes: 1 - ok, 0 - ignore, other - error. */
+static int
+arch_get_scno(struct tcb *tcp)
+{
+ tcp->scno = loongarch_regs.regs[11];
+ return 1;
+}
diff --git a/src/linux/loongarch64/get_syscall_args.c b/src/linux/loongarch64/get_syscall_args.c
new file mode 100644
index 0000000..e97aa72
--- /dev/null
+++ b/src/linux/loongarch64/get_syscall_args.c
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+/* Return -1 on error or 1 on success (never 0!). */
+static int
+arch_get_syscall_args(struct tcb *tcp)
+{
+ tcp->u_arg[0] = loongarch_regs.orig_a0;
+ tcp->u_arg[1] = loongarch_regs.regs[5];
+ tcp->u_arg[2] = loongarch_regs.regs[6];
+ tcp->u_arg[3] = loongarch_regs.regs[7];
+ tcp->u_arg[4] = loongarch_regs.regs[8];
+ tcp->u_arg[5] = loongarch_regs.regs[9];
+ return 1;
+}
diff --git a/src/linux/loongarch64/ioctls_arch0.h b/src/linux/loongarch64/ioctls_arch0.h
new file mode 100644
index 0000000..59d8aaa
--- /dev/null
+++ b/src/linux/loongarch64/ioctls_arch0.h
@@ -0,0 +1 @@
+/* Generated by ioctls_gen.sh from definitions found in $linux/arch/loongarch/include/ tree. */
diff --git a/src/linux/loongarch64/ioctls_inc0.h b/src/linux/loongarch64/ioctls_inc0.h
new file mode 100644
index 0000000..6028afb
--- /dev/null
+++ b/src/linux/loongarch64/ioctls_inc0.h
@@ -0,0 +1 @@
+#include "../64/ioctls_inc.h"
diff --git a/src/linux/loongarch64/raw_syscall.h b/src/linux/loongarch64/raw_syscall.h
new file mode 100644
index 0000000..1227778
--- /dev/null
+++ b/src/linux/loongarch64/raw_syscall.h
@@ -0,0 +1,29 @@
+/*
+ * Raw syscalls.
+ *
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef STRACE_RAW_SYSCALL_H
+# define STRACE_RAW_SYSCALL_H
+
+# include "kernel_types.h"
+
+static inline kernel_ulong_t
+raw_syscall_0(const kernel_ulong_t nr, kernel_ulong_t *err)
+{
+ *err = 0;
+ register kernel_ulong_t a7 __asm__("a7") = nr;
+ register kernel_ulong_t a0 __asm__("a0");
+ __asm__ __volatile__("syscall 0"
+ : "=r"(a0)
+ : "r"(a7)
+ : "memory");
+ return a0;
+}
+# define raw_syscall_0 raw_syscall_0
+
+#endif /* !STRACE_RAW_SYSCALL_H */
diff --git a/src/linux/loongarch64/set_error.c b/src/linux/loongarch64/set_error.c
new file mode 100644
index 0000000..aa83a3e
--- /dev/null
+++ b/src/linux/loongarch64/set_error.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+static int
+arch_set_error(struct tcb *tcp)
+{
+ loongarch_regs.regs[4] = -tcp->u_error;
+ return set_regs(tcp->pid);
+}
+
+static int
+arch_set_success(struct tcb *tcp)
+{
+ loongarch_regs.regs[4] = tcp->u_rval;
+ return set_regs(tcp->pid);
+}
diff --git a/src/linux/loongarch64/set_scno.c b/src/linux/loongarch64/set_scno.c
new file mode 100644
index 0000000..d338f20
--- /dev/null
+++ b/src/linux/loongarch64/set_scno.c
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+static int
+arch_set_scno(struct tcb *tcp, kernel_ulong_t scno)
+{
+ if (ptrace_syscall_info_is_valid() && get_regs(tcp) < 0)
+ return -1;
+ loongarch_regs.regs[11] = scno;
+ return set_regs(tcp->pid);
+}
diff --git a/src/linux/loongarch64/syscallent.h b/src/linux/loongarch64/syscallent.h
new file mode 100644
index 0000000..5ab228b
--- /dev/null
+++ b/src/linux/loongarch64/syscallent.h
@@ -0,0 +1,8 @@
+/*
+ * Copyright (c) 2021-2022 The strace developers.
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include "../64/syscallent.h"
diff --git a/src/xlat/audit_arch.in b/src/xlat/audit_arch.in
index 63d3fe5..0760eb7 100644
--- a/src/xlat/audit_arch.in
+++ b/src/xlat/audit_arch.in
@@ -25,6 +25,8 @@ AUDIT_ARCH_H8300 (EM_H8_300) /* Removed in v3.13-rc1~130^2~2 */
AUDIT_ARCH_HEXAGON (EM_HEXAGON)
AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE)
AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
+AUDIT_ARCH_LOONGARCH32 (EM_LOONGARCH|__AUDIT_ARCH_LE)
+AUDIT_ARCH_LOONGARCH64 (EM_LOONGARCH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
AUDIT_ARCH_M32R (EM_M32R)
AUDIT_ARCH_M68K (EM_68K)
AUDIT_ARCH_MICROBLAZE (EM_MICROBLAZE)
diff --git a/src/xlat/elf_em.in b/src/xlat/elf_em.in
index 9ffbcd6..18f4c9a 100644
--- a/src/xlat/elf_em.in
+++ b/src/xlat/elf_em.in
@@ -190,6 +190,7 @@ EM_AMDGPU 224 /* AMD GPU architecture */
EM_RISCV 243 /* RISC-V */
EM_BPF 247 /* Linux BPF - in-kernel virtual machine */
EM_CSKY 252 /* C-SKY */
+EM_LOONGARCH 258 /* LoongArch */
EM_AVR32 0x18ad /* Atmel AVR32, removed in v4.12-rc1~159^2~5 */
EM_FRV 0x5441 /* Fujitsu FR-V */
EM_OR32 0x8472 /* arch/openrisc/include/uapi/asm/elf.h */
diff --git a/tests/ptrace.c b/tests/ptrace.c
index 8c98219..235aed9 100644
--- a/tests/ptrace.c
+++ b/tests/ptrace.c
@@ -185,7 +185,7 @@ test_peeksiginfo(int pid, const unsigned long bad_request)
# define TRACEE_REGS_STRUCT struct pt_regs
#elif defined __arm__
# define TRACEE_REGS_STRUCT struct pt_regs
-#elif defined __arm64__ || defined __aarch64__
+#elif defined __arm64__ || defined __aarch64__ || defined __loongarch__
# define TRACEE_REGS_STRUCT struct user_pt_regs
#elif defined __s390__ || defined __s390x__
# define TRACEE_REGS_STRUCT s390_regs
@@ -826,11 +826,51 @@ print_prstatus_regset(const void *const rs, const size_t size)
PRINT_FIELD_X(*regs, cp0_cause);
}
+# elif defined __loongarch__
+
+ if (size > offsetof(TRACEE_REGS_STRUCT, regs)) {
+ const size_t len = size - offsetof(TRACEE_REGS_STRUCT, regs);
+ fputs("regs=[", stdout);
+ for (unsigned int i = 0; i < ARRAY_SIZE(regs->regs); ++i) {
+ if (len > i * sizeof(regs->regs[i])) {
+ if (i)
+ fputs(", ", stdout);
+ PRINT_VAL_X(regs->regs[i]);
+ }
+ }
+ fputs("]", stdout);
+ }
+ if (size >= offsetofend(TRACEE_REGS_STRUCT, orig_a0)) {
+ fputs(", ", stdout);
+ PRINT_FIELD_X(*regs, orig_a0);
+ }
+ if (size >= offsetofend(TRACEE_REGS_STRUCT, csr_era)) {
+ fputs(", ", stdout);
+ PRINT_FIELD_X(*regs, csr_era);
+ }
+ if (size >= offsetofend(TRACEE_REGS_STRUCT, csr_badv)) {
+ fputs(", ", stdout);
+ PRINT_FIELD_X(*regs, csr_badv);
+ }
+ if (size > offsetof(TRACEE_REGS_STRUCT, reserved)) {
+ const size_t len = size - offsetof(TRACEE_REGS_STRUCT, reserved);
+ fputs(", reserved=[", stdout);
+ for (unsigned int i = 0; i < ARRAY_SIZE(regs->reserved); ++i) {
+ if (len > i * sizeof(regs->reserved[i])) {
+ if (i)
+ fputs(", ", stdout);
+ PRINT_VAL_X(regs->reserved[i]);
+ }
+ }
+ fputs("]", stdout);
+ }
+
# endif /*
__aarch64__ ||
__arm64__ ||
__arm__ ||
__i386__ ||
+ __loongarch__ ||
__mips__ ||
__powerpc64__ ||
__powerpc__ ||
@@ -1066,6 +1106,8 @@ typedef struct {
uint64_t fpscr;
} ppc_fpregs_struct;
# define TRACEE_REGS_STRUCT ppc_fpregs_struct
+#elif defined __loongarch__
+# define TRACEE_REGS_STRUCT struct user_fp_state
#endif
static void
@@ -1209,8 +1251,29 @@ print_fpregset(const void *const rs, const size_t size)
PRINT_FIELD_X(*regs, fpscr);
}
+# elif defined __loongarch__
+
+ fputs("fpr=[", stdout);
+ for (unsigned int i = 0; i < ARRAY_SIZE(regs->fpr); ++i) {
+ if (size > i * sizeof(regs->fpr[i])) {
+ if (i)
+ fputs(", ", stdout);
+ PRINT_VAL_X(regs->fpr[i]);
+ }
+ }
+ fputs("]", stdout);
+ if (size >= offsetofend(TRACEE_REGS_STRUCT, fcc)) {
+ fputs(", ", stdout);
+ PRINT_FIELD_X(*regs, fcc);
+ }
+ if (size >= offsetofend(TRACEE_REGS_STRUCT, fcsr)) {
+ fputs(", ", stdout);
+ PRINT_FIELD_X(*regs, fcsr);
+ }
+
# endif /*
__i386__ ||
+ __loongarch__ ||
__powerpc64__ ||
__powerpc__ ||
__x86_64__
--
2.38.0

View File

@ -0,0 +1,28 @@
From cab8b0976b7b1c7653728ab27014b2553416981b Mon Sep 17 00:00:00 2001
From: chenzanyu <chenzanyu@huawei.com>
Date: Tue, 4 Apr 2023 16:13:37 +0800
Subject: [PATCH] strace: solve ilp32 strace build error
reason: When constructing, HAVE_ARCH_OLD_TIME64_SYSCALLS SIZEOF_LONG == 8,
resulting in failure to build ilp32, need to add SIZEOF_LONG == 4 to fit ilp32
Signed-off-by: chenzanyu <chenzanyu@huawei.com>
---
src/arch_defs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/arch_defs.h b/src/arch_defs.h
index bb35252..e3d2bf3 100644
--- a/src/arch_defs.h
+++ b/src/arch_defs.h
@@ -66,7 +66,7 @@
# endif
# ifndef HAVE_ARCH_OLD_TIME64_SYSCALLS
-# define HAVE_ARCH_OLD_TIME64_SYSCALLS (SIZEOF_LONG == 8)
+# define HAVE_ARCH_OLD_TIME64_SYSCALLS ((SIZEOF_LONG == 4) || (SIZEOF_LONG == 8))
# endif
# ifndef MIN_KLONGSIZE
--
2.12.3

3333
strace-5.14-sw.patch Executable file

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
Summary: Tracks and displays system calls associated with a running process
Name: strace
Version: 5.14
Release: 1
Release: 6
# The test suite is GPLv2+, all the rest is LGPLv2.1+.
License: LGPL-2.1+ and GPL-2.0+
# Some distros require Group tag to be present,
@ -11,28 +11,26 @@ License: LGPL-2.1+ and GPL-2.0+
# some do not care about Group tag at all,
# and we have to cater for all of them.
URL: https://strace.io
%if 0%{?fedora} >= 12 || 0%{?centos} >= 6 || 0%{?rhel} >= 6 || 0%{?suse_version} >= 1200 || 0%{?openEuler} >= 1
Source: https://strace.io/files/%{version}/strace-%{version}.tar.xz
BuildRequires: xz
%else
Source: strace-%{version}.tar.gz
%ifarch sw_64
Patch1: strace-5.14-sw.patch
%endif
Patch2: strace-5.14-loongarch64.patch
Patch3: strace-5.14-solve-ilp32-strace-build-error.patch
Patch4: backport-0001-Move-print_debug_info-definition-before-cleanup.patch
Patch5: backport-0002-Factor-out-droptcb_verbose-from-detach.patch
Patch6: backport-0003-Factor-out-interrupt_or_stop-from-detach.patch
Patch7: backport-0004-Factor-out-detach_interrupted_or_stopped-from-detach.patch
Patch8: backport-0005-strace-fix-potential-deadlock-during-cleanup.patch
BuildRequires: gcc gzip
# Install Bluetooth headers for AF_BLUETOOTH sockets decoding.
%if 0%{?fedora} >= 18 || 0%{?centos} >= 6 || 0%{?rhel} >= 8 || 0%{?suse_version} >= 1200 || 0%{?openEuler} >= 1
BuildRequires: pkgconfig(bluez)
%endif
# Install elfutils-devel or libdw-devel to enable strace -k option.
# Install binutils-devel to enable symbol demangling.
%if 0%{?fedora} >= 20 || 0%{?centos} >= 6 || 0%{?rhel} >= 6 || 0%{?openEuler} >= 1
%define buildrequires_stacktrace BuildRequires: elfutils-devel binutils-devel
%endif
%if 0%{?suse_version} >= 1100
%define buildrequires_stacktrace BuildRequires: libdw-devel binutils-devel
%endif
%{?buildrequires_stacktrace}
BuildRequires: elfutils-devel binutils-devel
# OBS compatibility
%{?!buildroot:BuildRoot: %_tmppath/buildroot-%name-%version-%release}
@ -101,6 +99,21 @@ wait
%{_mandir}/man1/*
%changelog
* Fri Dec 27 2024 wangxiao <wangxiao184@h-partners.com> - 5.14-6
- strace: fix potential deadlock during cleanup
* Wed Feb 28 2024 liuchao <liuchao173@huawei.com> - 5.14-5
- remove redundant judgments
* Tue Apr 4 2023 chenzanyu <chenzanyu@huawei.com> - 5.14-4
- solve ilp32 strace build error
* Tue Jan 10 2023 Hui Li<lihui@loongson.cn> - 5.14-3
- Add loongarch64 architecture
* Tue Oct 25 2022 wuzx<wuzx1226@qq.com> - 5.14-2
- Add sw64 architecture
* Mon Nov 29 2021 zhouwenpei <zhouwenpei1@huawei.com> - 5.14-1
- update to 5.14