From: Robert Swiecki Date: Wed, 18 Jan 2017 21:32:27 +0000 (+0100) Subject: seccomp syscall printing: various formats of /proc//syscall X-Git-Tag: 1.3~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f990955d9ed5e9b3c05c1c5d1f3d946cadb6ac48;p=platform%2Fupstream%2Fnsjail.git seccomp syscall printing: various formats of /proc//syscall --- diff --git a/subproc.c b/subproc.c index 0882130..b2f350d 100644 --- a/subproc.c +++ b/subproc.c @@ -188,16 +188,21 @@ static void subprocSeccompViolation(struct nsjconf_t *nsjconf, siginfo_t * si) } buf[rdsize - 1] = '\0'; - uintptr_t sc, arg1, arg2, arg3, arg4, arg5, arg6, sp, pc; - if (sscanf - (buf, "%td %tx %tx %tx %tx %tx %tx %tx %tx", &sc, &arg1, &arg2, &arg3, &arg4, &arg5, - &arg6, &sp, &pc) != 9) { - return; + uintptr_t arg1, arg2, arg3, arg4, arg5, arg6, sp, pc; + ptrdiff_t sc; + int ret = + sscanf(buf, "%td %tx %tx %tx %tx %tx %tx %tx %tx", &sc, &arg1, &arg2, &arg3, &arg4, + &arg5, &arg6, &sp, &pc); + if (ret == 9) { + LOG_W + ("PID: %d, Syscall number: %td, Arguments: %#tx, %#tx, %#tx, %#tx, %#tx, %#tx, SP: %#tx, PC: %#tx", + (int)si->si_pid, sc, arg1, arg2, arg3, arg4, arg5, arg6, sp, pc); + } else if (ret == 3) { + LOG_W("PID: %d, Syscall number: %td, Arguments: %#tx, %#tx", (int)si->si_pid, sc, + arg1, arg2); + } else { + LOG_W("PID: %d, Syscall string '%s'", (int)si->si_pid, buf); } - - LOG_W - ("PID: %d, Syscall number: %td, Arguments: %#tx, %#tx, %#tx, %#tx, %#tx, %#tx, SP: %#tx, PC: %#tx", - (int)si->si_pid, sc, arg1, arg2, arg3, arg4, arg5, arg6, sp, pc); } int subprocReap(struct nsjconf_t *nsjconf)