strace/SOURCES/0040-syscall-do-not-capture-stack-trace-while-the-tracee-.patch
2021-09-10 04:56:01 +00:00

43 lines
1.2 KiB
Diff

From 35e080ae319d25c1df82855cda3a1bb014e90ba6 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Wed, 8 Jan 2020 00:41:58 +0000
Subject: [PATCH] syscall: do not capture stack trace while the tracee executes
strace code
* syscall.c (syscall_entering_trace) [ENABLE_STACKTRACE]: Do not capture
stack trace when TCB_CHECK_EXEC_SYSCALL flag is set.
---
syscall.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/syscall.c b/syscall.c
index fadd3b5..a8fb4f1 100644
--- a/syscall.c
+++ b/syscall.c
@@ -620,7 +620,7 @@ syscall_entering_trace(struct tcb *tcp, unsigned int *sig)
if (hide_log(tcp)) {
/*
* Restrain from fault injection
- * while the trace executes strace code.
+ * while the tracee executes strace code.
*/
tcp->qual_flg &= ~QUAL_INJECT;
@@ -655,9 +655,10 @@ syscall_entering_trace(struct tcb *tcp, unsigned int *sig)
}
#ifdef ENABLE_STACKTRACE
- if (stack_trace_enabled) {
- if (tcp_sysent(tcp)->sys_flags & STACKTRACE_CAPTURE_ON_ENTER)
- unwind_tcb_capture(tcp);
+ if (stack_trace_enabled &&
+ !check_exec_syscall(tcp) &&
+ tcp_sysent(tcp)->sys_flags & STACKTRACE_CAPTURE_ON_ENTER) {
+ unwind_tcb_capture(tcp);
}
#endif
--
2.1.4