]> granicus.if.org Git - strace/commit
Generalize seccomp filter parser
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 8 Jul 2017 01:49:00 +0000 (01:49 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 8 Jul 2017 01:49:00 +0000 (01:49 +0000)
commit899220d28da3a63a8c7db0a87b24db15784e6244
treeff4131199899ed79a0e0a25a4aada26cd4af61a5
parentcc5db1c8931f3cc20369206775144ec3fbe69679
Generalize seccomp filter parser

Linux socket filter uses almost the same classic BPF as seccomp filter,
The only difference noticeable from strace PoV is the meaning of generic
multiuse field.

Transform the parser of seccomp filters to a more generic parser
of classic BPF, parametrized with a method of parsing the generic
multiuse field in BPF_STMT.

* bpf_filter.c: New file.
* bpf_filter.h: Likewise.
* bpf_fprog.h: Likewise.
* bpf_seccomp_filter.c: Likewise.
* fetch_bpf_fprog.c: Likewise.
* fetch_seccomp_fprog.c: Remove.
* seccomp_fprog.h: Likewise.
* Makefile.am (strace_SOURCES): Add bpf_filter.c, bpf_filter.h,
bpf_fprog.h, bpf_seccomp_filter.c, and fetch_bpf_fprog.c.
Remove fetch_seccomp_fprog.c and seccomp_fprog.h.
* seccomp.c: Do not include linux/filter.h and xlat header files.
Do not define SECCOMP_RET_ACTION.
(bpf_filter, decode_bpf_code, decode_bpf_stmt, decode_bpf_jump,
print_bpf_filter, print_seccomp_fprog, print_seccomp_filter): Remove.
* defs.h (print_seccomp_filter): Rename to decode_seccomp_fprog.
(SYS_FUNC(seccomp)): Replace print_seccomp_filter
with decode_seccomp_fprog.
* prctl.c (SYS_FUNC(prctl)): Likewise.
Makefile.am
bpf_filter.c [new file with mode: 0644]
bpf_filter.h [new file with mode: 0644]
bpf_fprog.h [new file with mode: 0644]
bpf_seccomp_filter.c [new file with mode: 0644]
defs.h
fetch_bpf_fprog.c [moved from fetch_seccomp_fprog.c with 76% similarity]
prctl.c
seccomp.c
seccomp_fprog.h [deleted file]