From 6a56ba6d95bb9f39396ef8c7cdda21bddc336294 Mon Sep 17 00:00:00 2001 From: Chen Jingpiao Date: Thu, 3 May 2018 21:00:38 +0800 Subject: [PATCH] trace_event: add a new event Prepare for seccomp-assisted syscall filtering. * strace.c (next_event): Capture PTRACE_EVENT_SECCOMP event. (dispatch_event): Handle PTRACE_EVENT_SECCOMP event. * trace_event.h (enum trace_event) : New enumeration entity. --- strace.c | 5 +++++ trace_event.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/strace.c b/strace.c index cd04b989..440bd087 100644 --- a/strace.c +++ b/strace.c @@ -2405,6 +2405,8 @@ next_event(int *pstatus, siginfo_t *si) return TE_STOP_BEFORE_EXECVE; case PTRACE_EVENT_EXIT: return TE_STOP_BEFORE_EXIT; + case PTRACE_EVENT_SECCOMP: + return TE_SECCOMP; default: return TE_RESTART; } @@ -2451,6 +2453,9 @@ dispatch_event(enum trace_event ret, int *pstatus, siginfo_t *si) case TE_RESTART: break; + case TE_SECCOMP: + break; + case TE_SYSCALL_STOP: if (trace_syscall(current_tcp, &restart_sig) < 0) { /* diff --git a/trace_event.h b/trace_event.h index 38883c81..edc36a7c 100644 --- a/trace_event.h +++ b/trace_event.h @@ -86,6 +86,11 @@ enum trace_event { * Restart the tracee with signal 0. */ TE_STOP_BEFORE_EXIT, + + /* + * SECCOMP_RET_TRACE rule is triggered. + */ + TE_SECCOMP, }; #endif /* !STRACE_TRACE_EVENT_H */ -- 2.40.0