Print seccomp-bpf arguments in an organized way
authorJagger <robert@swiecki.net>
Sun, 8 May 2016 01:36:16 +0000 (03:36 +0200)
committerJagger <robert@swiecki.net>
Sun, 8 May 2016 01:36:16 +0000 (03:36 +0200)
subproc.c

index 327d32c15e2d0f6b4f8d4d327f97a5b225a36a0f..cde304848000b69ee20889952cff418b289a351b 100644 (file)
--- a/subproc.c
+++ b/subproc.c
@@ -181,9 +181,14 @@ static void subprocSeccompViolation(struct nsjconf_t *nsjconf, siginfo_t * si)
        }
        buf[rdsize - 1] = '\0';
 
+       int sc;
+       unsigned long arg1, arg2, arg3, arg4, arg5, arg6, sp, pc;
+       if (sscanf(buf, "%d %lx %lx %lx %lx %lx %lx %lx %lx", &sc, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6, &sp, &pc) != 9) {
+               return;
+       }
+
        LOG_W
-           ("Contents of /proc/%d/syscall (the syscall number goes first, arguments follow): '%s'",
-            si->si_pid, buf);
+           ("Syscall number: %d, Arguments: %lx, %lx, %lx, %lx, %lx, %lx, SP: %lx, PC: %lx", sc, arg1, arg2, arg3, arg4, arg5, arg6, sp, pc);
 }
 
 int subprocReap(struct nsjconf_t *nsjconf)