aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@plumgrid.com>2014-07-30 23:34:14 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-02 18:02:38 -0400
commit4df95ff488eb796aab9566652c250330179def17 (patch)
tree23edb6ce7c751c2c932876ad005f0cf44fbc9cdf
parent009937e78a45553a86d26654f192b2fd9ebe289d (diff)
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>
-rw-r--r--Documentation/networking/filter.txt2
-rw-r--r--include/linux/filter.h2
-rw-r--r--kernel/bpf/core.c2
-rw-r--r--kernel/seccomp.c4
-rw-r--r--net/core/filter.c10
5 files changed, 10 insertions, 10 deletions
diff --git a/Documentation/networking/filter.txt b/Documentation/networking/filter.txt
index ee78eba78a9d..712068be8171 100644
--- a/Documentation/networking/filter.txt
+++ b/Documentation/networking/filter.txt
@@ -591,7 +591,7 @@ sk_unattached_filter_destroy() for destroying it. The macro
591SK_RUN_FILTER(filter, ctx) transparently invokes eBPF interpreter or JITed 591SK_RUN_FILTER(filter, ctx) transparently invokes eBPF interpreter or JITed
592code to run the filter. 'filter' is a pointer to struct sk_filter that we 592code to run the filter. 'filter' is a pointer to struct sk_filter that we
593got from sk_unattached_filter_create(), and 'ctx' the given context (e.g. 593got from sk_unattached_filter_create(), and 'ctx' the given context (e.g.
594skb pointer). All constraints and restrictions from sk_chk_filter() apply 594skb pointer). All constraints and restrictions from bpf_check_classic() apply
595before a conversion to the new layout is being done behind the scenes! 595before a conversion to the new layout is being done behind the scenes!
596 596
597Currently, the classic BPF format is being used for JITing on most of the 597Currently, the classic BPF format is being used for JITing on most of the
diff --git a/include/linux/filter.h b/include/linux/filter.h
index 3769341a745d..c4d0be4c5e75 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -361,7 +361,7 @@ void sk_unattached_filter_destroy(struct sk_filter *fp);
361int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 361int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
362int sk_detach_filter(struct sock *sk); 362int sk_detach_filter(struct sock *sk);
363 363
364int sk_chk_filter(const struct sock_filter *filter, unsigned int flen); 364int bpf_check_classic(const struct sock_filter *filter, unsigned int flen);
365int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, 365int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
366 unsigned int len); 366 unsigned int len);
367 367
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 265a02cc822d..b479807ec383 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -18,7 +18,7 @@
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 * 19 *
20 * Andi Kleen - Fix a few bad bugs and races. 20 * Andi Kleen - Fix a few bad bugs and races.
21 * Kris Katterjohn - Added many additional checks in sk_chk_filter() 21 * Kris Katterjohn - Added many additional checks in bpf_check_classic()
22 */ 22 */
23#include <linux/filter.h> 23#include <linux/filter.h>
24#include <linux/skbuff.h> 24#include <linux/skbuff.h>
diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index 565743db5384..f4a77d23f209 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -87,7 +87,7 @@ static void populate_seccomp_data(struct seccomp_data *sd)
87 * @filter: filter to verify 87 * @filter: filter to verify
88 * @flen: length of filter 88 * @flen: length of filter
89 * 89 *
90 * Takes a previously checked filter (by sk_chk_filter) and 90 * Takes a previously checked filter (by bpf_check_classic) and
91 * redirects all filter code that loads struct sk_buff data 91 * redirects all filter code that loads struct sk_buff data
92 * and related data through seccomp_bpf_load. It also 92 * and related data through seccomp_bpf_load. It also
93 * enforces length and alignment checking of those loads. 93 * enforces length and alignment checking of those loads.
@@ -239,7 +239,7 @@ static long seccomp_attach_filter(struct sock_fprog *fprog)
239 goto free_prog; 239 goto free_prog;
240 240
241 /* Check and rewrite the fprog via the skb checker */ 241 /* Check and rewrite the fprog via the skb checker */
242 ret = sk_chk_filter(fp, fprog->len); 242 ret = bpf_check_classic(fp, fprog->len);
243 if (ret) 243 if (ret)
244 goto free_prog; 244 goto free_prog;
245 245
diff --git a/net/core/filter.c b/net/core/filter.c
index d6cb287e4f59..5740ea08a3ad 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -18,7 +18,7 @@
18 * 2 of the License, or (at your option) any later version. 18 * 2 of the License, or (at your option) any later version.
19 * 19 *
20 * Andi Kleen - Fix a few bad bugs and races. 20 * Andi Kleen - Fix a few bad bugs and races.
21 * Kris Katterjohn - Added many additional checks in sk_chk_filter() 21 * Kris Katterjohn - Added many additional checks in bpf_check_classic()
22 */ 22 */
23 23
24#include <linux/module.h> 24#include <linux/module.h>
@@ -721,7 +721,7 @@ static bool chk_code_allowed(u16 code_to_probe)
721} 721}
722 722
723/** 723/**
724 * sk_chk_filter - verify socket filter code 724 * bpf_check_classic - verify socket filter code
725 * @filter: filter to verify 725 * @filter: filter to verify
726 * @flen: length of filter 726 * @flen: length of filter
727 * 727 *
@@ -734,7 +734,7 @@ static bool chk_code_allowed(u16 code_to_probe)
734 * 734 *
735 * Returns 0 if the rule set is legal or -EINVAL if not. 735 * Returns 0 if the rule set is legal or -EINVAL if not.
736 */ 736 */
737int sk_chk_filter(const struct sock_filter *filter, unsigned int flen) 737int bpf_check_classic(const struct sock_filter *filter, unsigned int flen)
738{ 738{
739 bool anc_found; 739 bool anc_found;
740 int pc; 740 int pc;
@@ -808,7 +808,7 @@ int sk_chk_filter(const struct sock_filter *filter, unsigned int flen)
808 808
809 return -EINVAL; 809 return -EINVAL;
810} 810}
811EXPORT_SYMBOL(sk_chk_filter); 811EXPORT_SYMBOL(bpf_check_classic);
812 812
813static int sk_store_orig_filter(struct sk_filter *fp, 813static int sk_store_orig_filter(struct sk_filter *fp,
814 const struct sock_fprog *fprog) 814 const struct sock_fprog *fprog)
@@ -968,7 +968,7 @@ static struct sk_filter *__sk_prepare_filter(struct sk_filter *fp)
968 fp->bpf_func = NULL; 968 fp->bpf_func = NULL;
969 fp->jited = 0; 969 fp->jited = 0;
970 970
971 err = sk_chk_filter(fp->insns, fp->len); 971 err = bpf_check_classic(fp->insns, fp->len);
972 if (err) { 972 if (err) {
973 __sk_filter_release(fp); 973 __sk_filter_release(fp);
974 return ERR_PTR(err); 974 return ERR_PTR(err);