From: Dmitry V. Levin Date: Tue, 20 Nov 2018 04:56:30 +0000 (+0000) Subject: syscall_entering_trace: optimize clearing of TCB_HIDE_LOG flag X-Git-Tag: v4.26~86 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a4c6b715db6d751c59b0ee872a144508195b189;p=strace syscall_entering_trace: optimize clearing of TCB_HIDE_LOG flag * syscall.c (syscall_entering_trace): Since we check for TCB_HIDE_LOG flag anyway, do not clean it unless it is set. --- diff --git a/syscall.c b/syscall.c index fe85b8bf..a038fa78 100644 --- a/syscall.c +++ b/syscall.c @@ -657,19 +657,25 @@ syscall_entering_decode(struct tcb *tcp) int syscall_entering_trace(struct tcb *tcp, unsigned int *sig) { - /* Restrain from fault injection while the trace executes strace code. */ if (hide_log(tcp)) { + /* + * Restrain from fault injection + * while the trace executes strace code. + */ tcp->qual_flg &= ~QUAL_INJECT; - } - switch (tcp->s_ent->sen) { - case SEN_execve: - case SEN_execveat: + switch (tcp->s_ent->sen) { + case SEN_execve: + case SEN_execveat: #if defined SPARC || defined SPARC64 - case SEN_execv: + case SEN_execv: #endif - tcp->flags &= ~TCB_HIDE_LOG; - break; + /* + * First exec* syscall makes the log visible. + */ + tcp->flags &= ~TCB_HIDE_LOG; + break; + } } if (!traced(tcp) || (tracing_paths && !pathtrace_match(tcp))) {