/kernel/linux/linux-5.10/drivers/net/team/ |
D | team_mode_loadbalance.c | 263 struct sock_fprog_kern *fprog; in __fprog_create() local 268 fprog = kmalloc(sizeof(*fprog), GFP_KERNEL); in __fprog_create() 269 if (!fprog) in __fprog_create() 271 fprog->filter = kmemdup(filter, data_len, GFP_KERNEL); in __fprog_create() 272 if (!fprog->filter) { in __fprog_create() 273 kfree(fprog); in __fprog_create() 276 fprog->len = data_len / sizeof(struct sock_filter); in __fprog_create() 277 *pfprog = fprog; in __fprog_create() 281 static void __fprog_destroy(struct sock_fprog_kern *fprog) in __fprog_destroy() argument 283 kfree(fprog->filter); in __fprog_destroy() [all …]
|
/kernel/linux/linux-5.10/net/core/ |
D | sock_diag.c | 74 struct sock_fprog_kern *fprog; in sock_diag_put_filterinfo() local 90 fprog = filter->prog->orig_prog; in sock_diag_put_filterinfo() 91 if (!fprog) in sock_diag_put_filterinfo() 94 flen = bpf_classic_proglen(fprog); in sock_diag_put_filterinfo() 102 memcpy(nla_data(attr), fprog->filter, flen); in sock_diag_put_filterinfo()
|
D | filter.c | 1130 const struct sock_fprog *fprog) in bpf_prog_store_orig_filter() argument 1132 unsigned int fsize = bpf_classic_proglen(fprog); in bpf_prog_store_orig_filter() 1140 fkprog->len = fprog->len; in bpf_prog_store_orig_filter() 1154 struct sock_fprog_kern *fprog = fp->orig_prog; in bpf_release_orig_filter() local 1156 if (fprog) { in bpf_release_orig_filter() 1157 kfree(fprog->filter); in bpf_release_orig_filter() 1158 kfree(fprog); in bpf_release_orig_filter() 1358 int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog) in bpf_prog_create() argument 1360 unsigned int fsize = bpf_classic_proglen(fprog); in bpf_prog_create() 1364 if (!bpf_check_basics_ok(fprog->filter, fprog->len)) in bpf_prog_create() [all …]
|
D | sock.c | 1064 struct sock_fprog fprog; in sock_setsockopt() local 1066 ret = copy_bpf_fprog_from_user(&fprog, optval, optlen); in sock_setsockopt() 1068 ret = sk_attach_filter(&fprog, sk); in sock_setsockopt() 1085 struct sock_fprog fprog; in sock_setsockopt() local 1087 ret = copy_bpf_fprog_from_user(&fprog, optval, optlen); in sock_setsockopt() 1089 ret = sk_reuseport_attach_filter(&fprog, sk); in sock_setsockopt()
|
/kernel/linux/linux-5.10/kernel/ |
D | seccomp.c | 543 static struct seccomp_filter *seccomp_prepare_filter(struct sock_fprog *fprog) in seccomp_prepare_filter() argument 549 if (fprog->len == 0 || fprog->len > BPF_MAXINSNS) in seccomp_prepare_filter() 552 BUG_ON(INT_MAX / fprog->len < sizeof(struct sock_filter)); in seccomp_prepare_filter() 570 ret = bpf_prog_create_from_user(&sfilter->prog, fprog, in seccomp_prepare_filter() 593 struct sock_fprog fprog; in seccomp_prepare_user_filter() local 601 fprog.len = fprog32.len; in seccomp_prepare_user_filter() 602 fprog.filter = compat_ptr(fprog32.filter); in seccomp_prepare_user_filter() 605 if (copy_from_user(&fprog, user_filter, sizeof(fprog))) in seccomp_prepare_user_filter() 607 filter = seccomp_prepare_filter(&fprog); in seccomp_prepare_user_filter() 1799 struct sock_fprog_kern *fprog; in seccomp_get_filter() local [all …]
|
/kernel/linux/linux-5.10/include/linux/ |
D | filter.h | 824 #define bpf_classic_proglen(fprog) (fprog->len * sizeof(fprog->filter[0])) argument 884 int bpf_prog_create(struct bpf_prog **pfp, struct sock_fprog_kern *fprog); 885 int bpf_prog_create_from_user(struct bpf_prog **pfp, struct sock_fprog *fprog, 889 int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 891 int sk_reuseport_attach_filter(struct sock_fprog *fprog, struct sock *sk);
|
/kernel/linux/linux-5.10/drivers/net/ppp/ |
D | ppp_generic.c | 562 struct sock_fprog_kern fprog; in get_filter() local 570 fprog.len = uprog->len; in get_filter() 571 fprog.filter = memdup_user(uprog->filter, in get_filter() 573 if (IS_ERR(fprog.filter)) in get_filter() 574 return ERR_CAST(fprog.filter); in get_filter() 576 err = bpf_prog_create(&res, &fprog); in get_filter() 577 kfree(fprog.filter); in get_filter()
|
/kernel/linux/linux-5.10/drivers/net/ |
D | tun.c | 205 struct sock_fprog fprog; member 795 err = sk_attach_filter(&tun->fprog, tfile->socket.sk); in tun_attach() 2942 ret = sk_attach_filter(&tun->fprog, tfile->socket.sk); in tun_attach_filter() 3320 if (copy_from_user(&tun->fprog, argp, sizeof(tun->fprog))) in __tun_chr_ioctl() 3340 if (copy_to_user(argp, &tun->fprog, sizeof(tun->fprog))) in __tun_chr_ioctl()
|
/kernel/linux/linux-5.10/lib/ |
D | test_bpf.c | 6563 struct sock_fprog_kern fprog; in generate_filter() local 6568 fprog.filter = fptr; in generate_filter() 6569 fprog.len = flen; in generate_filter() 6571 *err = bpf_prog_create(&fp, &fprog); in generate_filter() 6589 *err, fprog.len); in generate_filter()
|
/kernel/linux/linux-5.10/net/packet/ |
D | af_packet.c | 1552 struct sock_fprog fprog; in fanout_set_data_cbpf() local 1558 ret = copy_bpf_fprog_from_user(&fprog, data, len); in fanout_set_data_cbpf() 1562 ret = bpf_prog_create_from_user(&new, &fprog, NULL, false); in fanout_set_data_cbpf()
|