Skip to content

Commit 4df95ff

Browse files
Alexei Starovoitovdavem330
authored andcommitted
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>
1 parent 009937e commit 4df95ff

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎Documentation/networking/filter.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ sk_unattached_filter_destroy() for destroying it. The macro
591591
SK_RUN_FILTER(filter, ctx) transparently invokes eBPF interpreter or JITed
592592
code to run the filter. 'filter' is a pointer to struct sk_filter that we
593593
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
595595
before a conversion to the new layout is being done behind the scenes!
596596

597597
Currently, the classic BPF format is being used for JITing on most of the

‎include/linux/filter.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ void sk_unattached_filter_destroy(struct sk_filter *fp);
361361
int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
362362
int sk_detach_filter(struct sock *sk);
363363

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);
365365
int sk_get_filter(struct sock *sk, struct sock_filter __user *filter,
366366
unsigned int len);
367367

‎kernel/bpf/core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* 2 of the License, or (at your option) any later version.
1919
*
2020
* 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()
2222
*/
2323
#include <linux/filter.h>
2424
#include <linux/skbuff.h>

‎kernel/seccomp.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static void populate_seccomp_data(struct seccomp_data *sd)
8787
* @filter: filter to verify
8888
* @flen: length of filter
8989
*
90-
* Takes a previously checked filter (by sk_chk_filter) and
90+
* Takes a previously checked filter (by bpf_check_classic) and
9191
* redirects all filter code that loads struct sk_buff data
9292
* and related data through seccomp_bpf_load. It also
9393
* enforces length and alignment checking of those loads.
@@ -239,7 +239,7 @@ static long seccomp_attach_filter(struct sock_fprog *fprog)
239239
goto free_prog;
240240

241241
/* 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);
243243
if (ret)
244244
goto free_prog;
245245

‎net/core/filter.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* 2 of the License, or (at your option) any later version.
1919
*
2020
* 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()
2222
*/
2323

2424
#include <linux/module.h>
@@ -721,7 +721,7 @@ static bool chk_code_allowed(u16 code_to_probe)
721721
}
722722

723723
/**
724-
* sk_chk_filter - verify socket filter code
724+
* bpf_check_classic - verify socket filter code
725725
* @filter: filter to verify
726726
* @flen: length of filter
727727
*
@@ -734,7 +734,7 @@ static bool chk_code_allowed(u16 code_to_probe)
734734
*
735735
* Returns 0 if the rule set is legal or -EINVAL if not.
736736
*/
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)
738738
{
739739
bool anc_found;
740740
int pc;
@@ -808,7 +808,7 @@ int sk_chk_filter(const struct sock_filter *filter, unsigned int flen)
808808

809809
return -EINVAL;
810810
}
811-
EXPORT_SYMBOL(sk_chk_filter);
811+
EXPORT_SYMBOL(bpf_check_classic);
812812

813813
static int sk_store_orig_filter(struct sk_filter *fp,
814814
const struct sock_fprog *fprog)
@@ -968,7 +968,7 @@ static struct sk_filter *__sk_prepare_filter(struct sk_filter *fp)
968968
fp->bpf_func = NULL;
969969
fp->jited = 0;
970970

971-
err = sk_chk_filter(fp->insns, fp->len);
971+
err = bpf_check_classic(fp->insns, fp->len);
972972
if (err) {
973973
__sk_filter_release(fp);
974974
return ERR_PTR(err);

0 commit comments

Comments
 (0)