forked from Minki/linux
net: filter: rename sk_chk_filter() -> bpf_check_classic()
trivial rename to indicate that this functions performs classic BPF checking Signed-off-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
009937e78a
commit
4df95ff488
@ -591,7 +591,7 @@ sk_unattached_filter_destroy() for destroying it. The macro
|
|||||||
SK_RUN_FILTER(filter, ctx) transparently invokes eBPF interpreter or JITed
|
SK_RUN_FILTER(filter, ctx) transparently invokes eBPF interpreter or JITed
|
||||||
code to run the filter. 'filter' is a pointer to struct sk_filter that we
|
code to run the filter. 'filter' is a pointer to struct sk_filter that we
|
||||||
got from sk_unattached_filter_create(), and 'ctx' the given context (e.g.
|
got from sk_unattached_filter_create(), and 'ctx' the given context (e.g.
|
||||||
skb pointer). All constraints and restrictions from sk_chk_filter() apply
|
skb pointer). All constraints and restrictions from bpf_check_classic() apply
|
||||||
before a conversion to the new layout is being done behind the scenes!
|
before a conversion to the new layout is being done behind the scenes!
|
||||||
|
|
||||||
Currently, the classic BPF format is being used for JITing on most of the
|
Currently, the classic BPF format is being used for JITing on most of the
|
||||||
|
@ -361,7 +361,7 @@ void sk_unattached_filter_destroy(struct sk_filter *fp);
|
|||||||
int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
|
int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
|
||||||
int sk_detach_filter(struct sock *sk);
|
int sk_detach_filter(struct sock *sk);
|
||||||
|
|
||||||
int sk_chk_filter(const struct sock_filter *filter, unsigned int flen);
|
int bpf_check_classic(const struct sock_filter *filter, unsigned int flen);
|
||||||
int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
|
int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
|
||||||
unsigned int len);
|
unsigned int len);
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* 2 of the License, or (at your option) any later version.
|
* 2 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Andi Kleen - Fix a few bad bugs and races.
|
* Andi Kleen - Fix a few bad bugs and races.
|
||||||
* Kris Katterjohn - Added many additional checks in sk_chk_filter()
|
* Kris Katterjohn - Added many additional checks in bpf_check_classic()
|
||||||
*/
|
*/
|
||||||
#include <linux/filter.h>
|
#include <linux/filter.h>
|
||||||
#include <linux/skbuff.h>
|
#include <linux/skbuff.h>
|
||||||
|
@ -87,7 +87,7 @@ static void populate_seccomp_data(struct seccomp_data *sd)
|
|||||||
* @filter: filter to verify
|
* @filter: filter to verify
|
||||||
* @flen: length of filter
|
* @flen: length of filter
|
||||||
*
|
*
|
||||||
* Takes a previously checked filter (by sk_chk_filter) and
|
* Takes a previously checked filter (by bpf_check_classic) and
|
||||||
* redirects all filter code that loads struct sk_buff data
|
* redirects all filter code that loads struct sk_buff data
|
||||||
* and related data through seccomp_bpf_load. It also
|
* and related data through seccomp_bpf_load. It also
|
||||||
* enforces length and alignment checking of those loads.
|
* enforces length and alignment checking of those loads.
|
||||||
@ -239,7 +239,7 @@ static long seccomp_attach_filter(struct sock_fprog *fprog)
|
|||||||
goto free_prog;
|
goto free_prog;
|
||||||
|
|
||||||
/* Check and rewrite the fprog via the skb checker */
|
/* Check and rewrite the fprog via the skb checker */
|
||||||
ret = sk_chk_filter(fp, fprog->len);
|
ret = bpf_check_classic(fp, fprog->len);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto free_prog;
|
goto free_prog;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
* 2 of the License, or (at your option) any later version.
|
* 2 of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Andi Kleen - Fix a few bad bugs and races.
|
* Andi Kleen - Fix a few bad bugs and races.
|
||||||
* Kris Katterjohn - Added many additional checks in sk_chk_filter()
|
* Kris Katterjohn - Added many additional checks in bpf_check_classic()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
@ -721,7 +721,7 @@ static bool chk_code_allowed(u16 code_to_probe)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sk_chk_filter - verify socket filter code
|
* bpf_check_classic - verify socket filter code
|
||||||
* @filter: filter to verify
|
* @filter: filter to verify
|
||||||
* @flen: length of filter
|
* @flen: length of filter
|
||||||
*
|
*
|
||||||
@ -734,7 +734,7 @@ static bool chk_code_allowed(u16 code_to_probe)
|
|||||||
*
|
*
|
||||||
* Returns 0 if the rule set is legal or -EINVAL if not.
|
* Returns 0 if the rule set is legal or -EINVAL if not.
|
||||||
*/
|
*/
|
||||||
int sk_chk_filter(const struct sock_filter *filter, unsigned int flen)
|
int bpf_check_classic(const struct sock_filter *filter, unsigned int flen)
|
||||||
{
|
{
|
||||||
bool anc_found;
|
bool anc_found;
|
||||||
int pc;
|
int pc;
|
||||||
@ -808,7 +808,7 @@ int sk_chk_filter(const struct sock_filter *filter, unsigned int flen)
|
|||||||
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(sk_chk_filter);
|
EXPORT_SYMBOL(bpf_check_classic);
|
||||||
|
|
||||||
static int sk_store_orig_filter(struct sk_filter *fp,
|
static int sk_store_orig_filter(struct sk_filter *fp,
|
||||||
const struct sock_fprog *fprog)
|
const struct sock_fprog *fprog)
|
||||||
@ -968,7 +968,7 @@ static struct sk_filter *__sk_prepare_filter(struct sk_filter *fp)
|
|||||||
fp->bpf_func = NULL;
|
fp->bpf_func = NULL;
|
||||||
fp->jited = 0;
|
fp->jited = 0;
|
||||||
|
|
||||||
err = sk_chk_filter(fp->insns, fp->len);
|
err = bpf_check_classic(fp->insns, fp->len);
|
||||||
if (err) {
|
if (err) {
|
||||||
__sk_filter_release(fp);
|
__sk_filter_release(fp);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
|
Loading…
Reference in New Issue
Block a user