From 422ecbe6759bd726e34914616dc2e1a1da78418a Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Tue, 20 Nov 2018 04:56:30 +0000
Subject: [PATCH] syscall_entering_trace: set TCB_FILTERED along with
 TCB_HIDE_LOG

This allows to remove some of hide_log() checks that became redundant.

* syscall.c (syscall_entering_trace): Set TCB_FILTERED along with
TCB_HIDE_LOG, remove now redundant hide_log(tcp) check.
(syscall_exiting_decode): Replace "filtered(tcp) || hide_log(tcp)"
with "filtered(tcp)".
---
 syscall.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/syscall.c b/syscall.c
index a038fa78..04b99397 100644
--- a/syscall.c
+++ b/syscall.c
@@ -675,6 +675,9 @@ syscall_entering_trace(struct tcb *tcp, unsigned int *sig)
 				 */
 				tcp->flags &= ~TCB_HIDE_LOG;
 				break;
+			default:
+				tcp->flags |= TCB_FILTERED;
+				return 0;
 		}
 	}
 
@@ -685,10 +688,6 @@ syscall_entering_trace(struct tcb *tcp, unsigned int *sig)
 
 	tcp->flags &= ~TCB_FILTERED;
 
-	if (hide_log(tcp)) {
-		return 0;
-	}
-
 	if (inject(tcp))
 		tamper_with_syscall_entering(tcp, sig);
 
@@ -732,13 +731,13 @@ int
 syscall_exiting_decode(struct tcb *tcp, struct timespec *pts)
 {
 	/* Measure the exit time as early as possible to avoid errors. */
-	if ((Tflag || cflag) && !(filtered(tcp) || hide_log(tcp)))
+	if ((Tflag || cflag) && !filtered(tcp))
 		clock_gettime(CLOCK_MONOTONIC, pts);
 
 	if (tcp->s_ent->sys_flags & MEMORY_MAPPING_CHANGE)
 		mmap_notify_report(tcp);
 
-	if (filtered(tcp) || hide_log(tcp))
+	if (filtered(tcp))
 		return 0;
 
 #if SUPPORTED_PERSONALITIES > 1
-- 
2.40.0