]> granicus.if.org Git - strace/commitdiff
syscall_entering_trace: optimize clearing of TCB_HIDE_LOG flag
authorDmitry V. Levin <ldv@altlinux.org>
Tue, 20 Nov 2018 04:56:30 +0000 (04:56 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 20 Nov 2018 04:56:30 +0000 (04:56 +0000)
* syscall.c (syscall_entering_trace): Since we check for TCB_HIDE_LOG
flag anyway, do not clean it unless it is set.

syscall.c

index fe85b8bfa5104e01b3611f5b44a3c0a4b588a303..a038fa78c6e82792f8f0d523ecb93ed0a1bdf252 100644 (file)
--- 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))) {