From a59e41e1215b5565af5697eb79f877c63be442c2 Mon Sep 17 00:00:00 2001 From: Eugene Syromyatnikov Date: Wed, 7 Feb 2018 02:16:50 +0100 Subject: [PATCH] syscall.c: warn if tampering failed --- syscall.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/syscall.c b/syscall.c index 79e99861..4ef34f4b 100644 --- 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) { -- 2.40.0