History

net: filter: rename sk_chk_filter() -> bpf_check_classic()

trivial rename to indicate that this functions performs classic BPF checking

Alexei Starovoitov committed 12 years ago

Commit 4df95ff1 parent 009937e5 files · +10 −10Browse files

Unified · Split

5 files
  1. Documentation/networking/filter.txt +1 −1
  2. include/linux/filter.h +1 −1
  3. kernel/bpf/core.c +1 −1
  4. kernel/seccomp.c +2 −2
  5. net/core/filter.c +5 −5
Documentation/networking/filter.txt+1−1
@@ -591,7 +591,7 @@ sk_unattached_filter_destroy() for destroying it. The macro · 590 unmodified lines
591SK_RUN_FILTER(filter, ctx) transparently invokes eBPF interpreter or JITed591SK_RUN_FILTER(filter, ctx) transparently invokes eBPF interpreter or JITed
592code to run the filter. 'filter' is a pointer to struct sk_filter that we592code 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() apply594skb 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 the597Currently, the classic BPF format is being used for JITing on most of the
include/linux/filter.h+1−1
@@ -361,7 +361,7 @@ void sk_unattached_filter_destroy(struct sk_filter *fp); · 360 unmodified lines
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
kernel/bpf/core.c+1−1
@@ -18,7 +18,7 @@ · 17 unmodified lines
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>
kernel/seccomp.c+2−2
@@ -87,7 +87,7 @@ static void populate_seccomp_data(struct seccomp_data *sd) · 86 unmodified lines
87 * @filter: filter to verify87 * @filter: filter to verify
88 * @flen: length of filter88 * @flen: length of filter
89 *89 *
90 * Takes a previously checked filter (by sk_chk_filter) and90 * Takes a previously checked filter (by bpf_check_classic) and
91 * redirects all filter code that loads struct sk_buff data91 * redirects all filter code that loads struct sk_buff data
92 * and related data through seccomp_bpf_load. It also92 * 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) · 145 unmodified lines
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
net/core/filter.c+5−5
@@ -18,7 +18,7 @@ · 17 unmodified lines
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) · 696 unmodified lines
721}721}
722 722
723/**723/**
724 * sk_chk_filter - verify socket filter code724 * bpf_check_classic - verify socket filter code
725 * @filter: filter to verify725 * @filter: filter to verify
726 * @flen: length of filter726 * @flen: length of filter
727 *727 *
@@ -734,7 +734,7 @@ static bool chk_code_allowed(u16 code_to_probe) · 6 unmodified lines
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) · 67 unmodified lines
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) · 153 unmodified lines
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);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t