@@ -103,19 +103,19 @@ int user_trap_syscalls(const int *nrs, size_t length, unsigned int flags) {
103
103
struct sock_filter filter [MAX_FILTER_SIZE ];
104
104
105
105
// load arch
106
- filter [0 ] = (struct sock_filter ) {( unsigned short ) BPF_LD + BPF_W + BPF_ABS , 0 , 0 , offsetof(struct seccomp_data , arch )} ;
106
+ filter [0 ] = (struct sock_filter ) BPF_STMT ( BPF_LD + BPF_W + BPF_ABS , offsetof(struct seccomp_data , arch )) ;
107
107
108
108
// check arch
109
- filter [1 ] = (struct sock_filter ) {( unsigned short ) BPF_JMP + BPF_JEQ + BPF_K , 0 , 2 , AUDIT_ARCH_X86_64 } ;
109
+ filter [1 ] = (struct sock_filter ) BPF_JUMP ( BPF_JMP + BPF_JEQ + BPF_K , AUDIT_ARCH_X86_64 , 0 , 2 ) ;
110
110
111
111
// load the number of the current syscall
112
- filter [2 ] = (struct sock_filter ) {( unsigned short ) BPF_LD + BPF_W + BPF_ABS , 0 , 0 , offsetof(struct seccomp_data , nr )} ;
112
+ filter [2 ] = (struct sock_filter ) BPF_STMT ( BPF_LD + BPF_W + BPF_ABS , offsetof(struct seccomp_data , nr )) ;
113
113
114
114
// for the x32 ABI, all system call numbers have bit 30 set
115
- filter [3 ] = (struct sock_filter ) {( unsigned short ) BPF_JMP + BPF_JGE + BPF_K , 0 , 1 , X32_SYSCALL_BIT } ;
115
+ filter [3 ] = (struct sock_filter ) BPF_JUMP (( unsigned short ) BPF_JMP + BPF_JGE + BPF_K , X32_SYSCALL_BIT , 0 , 1 ) ;
116
116
117
117
// terminate the process if one of the earlier checks jumped here
118
- filter [4 ] = (struct sock_filter ) {( unsigned short ) BPF_RET + BPF_K , 0 , 0 , SECCOMP_RET_KILL_PROCESS } ;
118
+ filter [4 ] = (struct sock_filter ) BPF_STMT (( unsigned short ) BPF_RET + BPF_K , SECCOMP_RET_KILL_PROCESS ) ;
119
119
120
120
// now with the syscall nr still loaded, dynamically add checks for all syscall nrs we want to intercept
121
121
// Warning: If there are more nrs than MAX_FILTER_SIZE - 3, we may omit some system calls
@@ -134,10 +134,10 @@ int user_trap_syscalls(const int *nrs, size_t length, unsigned int flags) {
134
134
}
135
135
136
136
// didn't find a matching syscall, so return allow
137
- filter [bpf_length - 2 ] = (struct sock_filter ) {( unsigned short ) BPF_RET + BPF_K , 0 , 0 , SECCOMP_RET_ALLOW } ;
137
+ filter [bpf_length - 2 ] = (struct sock_filter ) BPF_STMT (( unsigned short ) BPF_RET + BPF_K , SECCOMP_RET_ALLOW ) ;
138
138
139
139
// this is the jump target. If we found a matching syscall, we return SECCOMP_RET_USER_NOTIF
140
- filter [bpf_length - 1 ] = (struct sock_filter ) {( unsigned short ) BPF_RET + BPF_K , 0 , 0 , SECCOMP_RET_USER_NOTIF } ;
140
+ filter [bpf_length - 1 ] = (struct sock_filter ) BPF_STMT (( unsigned short ) BPF_RET + BPF_K , SECCOMP_RET_USER_NOTIF ) ;
141
141
142
142
struct sock_fprog prog = {
143
143
.len = (unsigned short ) bpf_length ,
0 commit comments