Blame SOURCES/0040-syscall-do-not-capture-stack-trace-while-the-tracee-.patch

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