wire / wire-format / seccomp-filter

seccomp BPF filter (sock_filter / seccomp_data)

A seccomp filter is a BPF program (array of sock_filter instructions) that inspects each syscall via a seccomp_data structure. Each 8-byte sock_filter: code (2 bytes), jt (1 byte), jf (1 byte), k (4 bytes). The filter returns SECCOMP_RET_KILL_PROCESS, SECCOMP_RET_KILL_THREAD, SECCOMP_RET_TRAP, SECCOMP_RET_ERRNO, SECCOMP_RET_TRACE, SECCOMP_RET_LOG, or SECCOMP_RET_ALLOW.

wire-format kind wire-format status standard verification verified tier B wire-format@1

aka: seccomp BPF filter (sock_filter / seccomp_data)

wire format

spec: Linux kernel (seccomp)

A seccomp filter is a BPF program (array of sock_filter instructions) that inspects each syscall via a seccomp_data structure. Each 8-byte sock_filter: code (2 bytes), jt (1 byte), jf (1 byte), k (4 bytes). The filter returns SECCOMP_RET_KILL_PROCESS, SECCOMP_RET_KILL_THREAD, SECCOMP_RET_TRAP, SECCOMP_RET_ERRNO, SECCOMP_RET_TRACE, SECCOMP_RET_LOG, or SECCOMP_RET_ALLOW.

fieldsizemeaning
seccomp_data.nr4 bytes (__s32)System call number.
seccomp_data.arch4 bytes (__u32)Architecture (AUDIT_ARCH_X86_64, AUDIT_ARCH_AARCH64, ...).
seccomp_data.instruction_pointer8 bytes (__u64)IP at the time of the syscall.
seccomp_data.args[0..5]6 x 8 bytes (__u64)The six syscall arguments.
sock_filter.code2 bytes (__u16)BPF instruction code (BPF_LD, BPF_JMP, BPF_RET, ...).
sock_filter.jt1 byte (__u8)Jump if true (offset).
sock_filter.jf1 byte (__u8)Jump if false (offset).
sock_filter.k4 bytes (__u32)Constant / address offset.

example:

00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

seccomp_data (64 bytes) + empty filter


provenance

agent: curl -H 'accept: application/json' wire.phall.io/wire-format/seccomp-filter or /wire-format/seccomp-filter.json