]> granicus.if.org Git - strace/commitdiff
trace_event: add a new event
authorChen Jingpiao <chenjingpiao@gmail.com>
Thu, 3 May 2018 13:00:38 +0000 (21:00 +0800)
committerChen Jingpiao <chenjingpiao@gmail.com>
Tue, 14 Aug 2018 14:08:42 +0000 (22:08 +0800)
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) <TE_SECCOMP>: New enumeration entity.

strace.c
trace_event.h

index cd04b9898f6a2ea7afd9e75d7ee6a789782912e3..440bd087efcd23b1837e75bf38666ce307eb1ab0 100644 (file)
--- 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) {
                        /*
index 38883c8144a7a25bd4bc33d8e7f0618d53b10aa3..edc36a7c75b8d8a085dcf1777f159af68d878345 100644 (file)
@@ -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 */