diff options
author | Nicolas Schichan <nschichan@freebox.fr> | 2015-05-06 16:12:27 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-09 17:35:05 -0400 |
commit | 4ae92bc77ac8e620f7c8d59b5882a4cb0d1c4ef1 (patch) | |
tree | d8a3a893390631cfaf0547929b8b89c715501b08 /include | |
parent | 0e00a0f73f9c7f5e9f02d064ed0165a3aeeb2de5 (diff) | |
download | linux-4ae92bc77ac8e620f7c8d59b5882a4cb0d1c4ef1.tar.gz linux-4ae92bc77ac8e620f7c8d59b5882a4cb0d1c4ef1.tar.bz2 linux-4ae92bc77ac8e620f7c8d59b5882a4cb0d1c4ef1.zip |
net: filter: add a callback to allow classic post-verifier transformations
This is in preparation for use by the seccomp code, the rationale is
not to duplicate additional code within the seccomp layer, but instead,
have it abstracted and hidden within the classic BPF API.
As an interim step, this now also makes bpf_prepare_filter() visible
(not as exported symbol though), so that seccomp can reuse that code
path instead of reimplementing it.
Joint work with Daniel Borkmann.
Signed-off-by: Nicolas Schichan <nschichan@freebox.fr>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Kees Cook <keescook@chromium.org>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/filter.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/filter.h b/include/linux/filter.h index fa11b3a367be..91996247cb55 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -384,7 +384,13 @@ int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); int sk_attach_bpf(u32 ufd, struct sock *sk); int sk_detach_filter(struct sock *sk); +typedef int (*bpf_aux_classic_check_t)(struct sock_filter *filter, + unsigned int flen); + int bpf_check_classic(const struct sock_filter *filter, unsigned int flen); +struct bpf_prog *bpf_prepare_filter(struct bpf_prog *fp, + bpf_aux_classic_check_t trans); + int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, unsigned int len); |