]> granicus.if.org Git - strace/commitdiff
syscall.c: warn if tampering failed
authorEugene Syromyatnikov <evgsyr@gmail.com>
Wed, 7 Feb 2018 01:16:50 +0000 (02:16 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 10 Feb 2018 01:33:49 +0000 (01:33 +0000)
syscall.c

index 79e9986126ad4bb4265b50c05e60870330cabd2b..4ef34f4b54b17316ef715dfa2e9aa0bcab6bcb51 100644 (file)
--- a/syscall.c
+++ b/syscall.c
@@ -551,6 +551,14 @@ tamper_with_syscall_entering(struct tcb *tcp, unsigned int *signo)
 static long
 tamper_with_syscall_exiting(struct tcb *tcp)
 {
+       if (!syserror(tcp)) {
+               error_msg("Failed to tamper with process %d: got no error "
+                         "(return value %#" PRI_klx ")",
+                         tcp->pid, tcp->u_rval);
+
+               return 1;
+       }
+
        struct inject_opts *opts = tcb_inject_opts(tcp);
 
        if (!opts)
@@ -731,7 +739,7 @@ syscall_exiting_decode(struct tcb *tcp, struct timeval *ptv)
 int
 syscall_exiting_trace(struct tcb *tcp, struct timeval tv, int res)
 {
-       if (syserror(tcp) && syscall_tampered(tcp))
+       if (syscall_tampered(tcp))
                tamper_with_syscall_exiting(tcp);
 
        if (cflag) {