trivial rename to indicate that this functions performs classic BPF checking
Unified · Split
| @@ -591,7 +591,7 @@ sk_unattached_filter_destroy() for destroying it. The macro · 590 unmodified lines | ||
| 591 | 591 | SK_RUN_FILTER(filter, ctx) transparently invokes eBPF interpreter or JITed |
| 592 | 592 | code to run the filter. 'filter' is a pointer to struct sk_filter that we |
| 593 | 593 | got from sk_unattached_filter_create(), and 'ctx' the given context (e.g. |
| 594 | −skb pointer). All constraints and restrictions from sk_chk_filter() apply | |
| 594 | +skb pointer). All constraints and restrictions from bpf_check_classic() apply | |
| 595 | 595 | before a conversion to the new layout is being done behind the scenes! |
| 596 | 596 | |
| 597 | 597 | 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); · 360 unmodified lines | ||
| 361 | 361 | int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); |
| 362 | 362 | int sk_detach_filter(struct sock *sk); |
| 363 | 363 | |
| 364 | −int sk_chk_filter(const struct sock_filter *filter, unsigned int flen); | |
| 364 | +int bpf_check_classic(const struct sock_filter *filter, unsigned int flen); | |
| 365 | 365 | int sk_get_filter(struct sock *sk, struct sock_filter __user *filter, |
| 366 | 366 | unsigned int len); |
| 367 | 367 | |
| @@ -18,7 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | * 2 of the License, or (at your option) any later version. |
| 19 | 19 | * |
| 20 | 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 | #include <linux/filter.h> |
| 24 | 24 | #include <linux/skbuff.h> |
| @@ -87,7 +87,7 @@ static void populate_seccomp_data(struct seccomp_data *sd) · 86 unmodified lines | ||
| 87 | 87 | * @filter: filter to verify |
| 88 | 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 | 91 | * redirects all filter code that loads struct sk_buff data |
| 92 | 92 | * and related data through seccomp_bpf_load. It also |
| 93 | 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 | 239 | goto free_prog; |
| 240 | 240 | |
| 241 | 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 | 243 | if (ret) |
| 244 | 244 | goto free_prog; |
| 245 | 245 | |
| @@ -18,7 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | * 2 of the License, or (at your option) any later version. |
| 19 | 19 | * |
| 20 | 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 | 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 code | |
| 724 | + * bpf_check_classic - verify socket filter code | |
| 725 | 725 | * @filter: filter to verify |
| 726 | 726 | * @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 | 735 | * Returns 0 if the rule set is legal or -EINVAL if not. |
| 736 | 736 | */ |
| 737 | −int sk_chk_filter(const struct sock_filter *filter, unsigned int flen) | |
| 737 | +int bpf_check_classic(const struct sock_filter *filter, unsigned int flen) | |
| 738 | 738 | { |
| 739 | 739 | bool anc_found; |
| 740 | 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 | 809 | return -EINVAL; |
| 810 | 810 | } |
| 811 | −EXPORT_SYMBOL(sk_chk_filter); | |
| 811 | +EXPORT_SYMBOL(bpf_check_classic); | |
| 812 | 812 | |
| 813 | 813 | static int sk_store_orig_filter(struct sk_filter *fp, |
| 814 | 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 | 968 | fp->bpf_func = NULL; |
| 969 | 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 | 972 | if (err) { |
| 973 | 973 | __sk_filter_release(fp); |
| 974 | 974 | return ERR_PTR(err); |