/kernel/bpf/ |
D | syscall.c | 1930 static int find_prog_type(enum bpf_prog_type type, struct bpf_prog *prog) in find_prog_type() argument 1941 if (!bpf_prog_is_dev_bound(prog->aux)) in find_prog_type() 1942 prog->aux->ops = ops; in find_prog_type() 1944 prog->aux->ops = &bpf_offload_prog_ops; in find_prog_type() 1945 prog->type = type; in find_prog_type() 1960 static void bpf_audit_prog(const struct bpf_prog *prog, unsigned int op) in bpf_audit_prog() argument 1975 prog->aux->id, bpf_audit_str[op]); in bpf_audit_prog() 1979 static int bpf_prog_alloc_id(struct bpf_prog *prog) in bpf_prog_alloc_id() argument 1985 id = idr_alloc_cyclic(&prog_idr, prog, 1, INT_MAX, GFP_ATOMIC); in bpf_prog_alloc_id() 1987 prog->aux->id = id; in bpf_prog_alloc_id() [all …]
|
D | trampoline.c | 108 bool bpf_prog_has_trampoline(const struct bpf_prog *prog) in bpf_prog_has_trampoline() argument 110 enum bpf_attach_type eatype = prog->expected_attach_type; in bpf_prog_has_trampoline() 111 enum bpf_prog_type ptype = prog->type; in bpf_prog_has_trampoline() 275 *ip_arg |= link->link.prog->call_get_func_ip; in bpf_trampoline_get_progs() 523 static enum bpf_tramp_prog_type bpf_attach_type_to_tramp(struct bpf_prog *prog) in bpf_attach_type_to_tramp() argument 525 switch (prog->expected_attach_type) { in bpf_attach_type_to_tramp() 533 if (!prog->aux->attach_func_proto->type) in bpf_attach_type_to_tramp() 552 kind = bpf_attach_type_to_tramp(link->link.prog); in __bpf_trampoline_link_prog() 566 tr->extension_prog = link->link.prog; in __bpf_trampoline_link_prog() 568 link->link.prog->bpf_func); in __bpf_trampoline_link_prog() [all …]
|
D | core.c | 110 fp->aux->prog = fp; in bpf_prog_alloc_no_stats() 127 struct bpf_prog *prog; in bpf_prog_alloc() local 130 prog = bpf_prog_alloc_no_stats(size, gfp_extra_flags); in bpf_prog_alloc() 131 if (!prog) in bpf_prog_alloc() 134 prog->stats = alloc_percpu_gfp(struct bpf_prog_stats, gfp_flags); in bpf_prog_alloc() 135 if (!prog->stats) { in bpf_prog_alloc() 136 free_percpu(prog->active); in bpf_prog_alloc() 137 kfree(prog->aux); in bpf_prog_alloc() 138 vfree(prog); in bpf_prog_alloc() 145 pstats = per_cpu_ptr(prog->stats, cpu); in bpf_prog_alloc() [all …]
|
D | dispatcher.c | 26 struct bpf_dispatcher *d, struct bpf_prog *prog) in bpf_dispatcher_find_prog() argument 31 if (prog == d->progs[i].prog) in bpf_dispatcher_find_prog() 44 struct bpf_prog *prog) in bpf_dispatcher_add_prog() argument 48 if (!prog) in bpf_dispatcher_add_prog() 51 entry = bpf_dispatcher_find_prog(d, prog); in bpf_dispatcher_add_prog() 61 bpf_prog_inc(prog); in bpf_dispatcher_add_prog() 62 entry->prog = prog; in bpf_dispatcher_add_prog() 69 struct bpf_prog *prog) in bpf_dispatcher_remove_prog() argument 73 if (!prog) in bpf_dispatcher_remove_prog() 76 entry = bpf_dispatcher_find_prog(d, prog); in bpf_dispatcher_remove_prog() [all …]
|
D | bpf_lsm.c | 72 void bpf_lsm_find_cgroup_shim(const struct bpf_prog *prog, in BTF_SET_END() 77 if (btf_type_vlen(prog->aux->attach_func_proto) < 1 || in BTF_SET_END() 79 prog->aux->attach_btf_id)) { in BTF_SET_END() 85 args = btf_params(prog->aux->attach_func_proto); in BTF_SET_END() 98 const struct bpf_prog *prog) in bpf_lsm_verify_prog() argument 100 if (!prog->gpl_compatible) { in bpf_lsm_verify_prog() 106 if (!btf_id_set_contains(&bpf_lsm_hooks, prog->aux->attach_btf_id)) { in bpf_lsm_verify_prog() 108 prog->aux->attach_btf_id, prog->aux->attach_func_name); in bpf_lsm_verify_prog() 143 static bool bpf_ima_inode_hash_allowed(const struct bpf_prog *prog) in bpf_ima_inode_hash_allowed() argument 145 return bpf_lsm_is_sleepable_hook(prog->aux->attach_btf_id); in bpf_ima_inode_hash_allowed() [all …]
|
D | offload.c | 80 int bpf_prog_offload_init(struct bpf_prog *prog, union bpf_attr *attr) in bpf_prog_offload_init() argument 97 offload->prog = prog; in bpf_prog_offload_init() 112 prog->aux->offload = offload; in bpf_prog_offload_init() 127 int bpf_prog_offload_verifier_prep(struct bpf_prog *prog) in bpf_prog_offload_verifier_prep() argument 133 offload = prog->aux->offload; in bpf_prog_offload_verifier_prep() 135 ret = offload->offdev->ops->prepare(prog); in bpf_prog_offload_verifier_prep() 150 offload = env->prog->aux->offload; in bpf_prog_offload_verify_insn() 165 offload = env->prog->aux->offload; in bpf_prog_offload_finalize() 186 offload = env->prog->aux->offload; in bpf_prog_offload_replace_insn() 203 offload = env->prog->aux->offload; in bpf_prog_offload_remove_insns() [all …]
|
D | prog_iter.c | 16 struct bpf_prog *prog; in bpf_prog_seq_start() local 18 prog = bpf_prog_get_curr_or_next(&info->prog_id); in bpf_prog_seq_start() 19 if (!prog) in bpf_prog_seq_start() 24 return prog; in bpf_prog_seq_start() 39 __bpf_md_ptr(struct bpf_prog *, prog); 42 DEFINE_BPF_ITER_FUNC(bpf_prog, struct bpf_iter_meta *meta, struct bpf_prog *prog) in DEFINE_BPF_ITER_FUNC() argument 48 struct bpf_prog *prog; in DEFINE_BPF_ITER_FUNC() local 52 ctx.prog = v; in DEFINE_BPF_ITER_FUNC() 54 prog = bpf_iter_get_info(&meta, in_stop); in DEFINE_BPF_ITER_FUNC() 55 if (prog) in DEFINE_BPF_ITER_FUNC() [all …]
|
D | bpf_iter.c | 25 struct bpf_prog *prog; member 278 bpf_prog_put(iter_priv->prog); in iter_release() 334 struct bpf_prog *prog) in cache_btf_id() argument 336 tinfo->btf_id = prog->aux->attach_btf_id; in cache_btf_id() 339 bool bpf_iter_prog_supported(struct bpf_prog *prog) in bpf_iter_prog_supported() argument 341 const char *attach_fname = prog->aux->attach_func_name; in bpf_iter_prog_supported() 343 u32 prog_btf_id = prog->aux->attach_btf_id; in bpf_iter_prog_supported() 357 cache_btf_id(iter, prog); in bpf_iter_prog_supported() 365 prog->aux->ctx_arg_info_size = tinfo->reg_info->ctx_arg_info_size; in bpf_iter_prog_supported() 366 prog->aux->ctx_arg_info = tinfo->reg_info->ctx_arg_info; in bpf_iter_prog_supported() [all …]
|
D | cgroup.c | 37 const struct bpf_prog *prog; in bpf_prog_run_array_cg() local 49 while ((prog = READ_ONCE(item->prog))) { in bpf_prog_run_array_cg() 51 func_ret = run_prog(prog, ctx); in bpf_prog_run_array_cg() 209 struct bpf_prog *prog, in bpf_cgroup_storages_alloc() argument 220 map = prog->aux->cgroup_storage[stype]; in bpf_cgroup_storages_alloc() 228 storages[stype] = bpf_cgroup_storage_alloc(prog, stype); in bpf_cgroup_storages_alloc() 294 if (pl->prog) { in cgroup_bpf_release() 295 if (pl->prog->expected_attach_type == BPF_LSM_CGROUP) in cgroup_bpf_release() 296 bpf_trampoline_unlink_cgroup_shim(pl->prog); in cgroup_bpf_release() 297 bpf_prog_put(pl->prog); in cgroup_bpf_release() [all …]
|
D | net_namespace.c | 97 prog_array->items[i].prog = pos->link.prog; in fill_prog_array() 175 if (old_prog && old_prog != link->prog) in bpf_netns_link_update_prog() 177 if (new_prog->type != link->prog->type) in bpf_netns_link_update_prog() 196 old_prog = xchg(&link->prog, new_prog); in bpf_netns_link_update_prog() 297 int netns_bpf_prog_attach(const union bpf_attr *attr, struct bpf_prog *prog) in netns_bpf_prog_attach() argument 323 ret = flow_dissector_bpf_prog_attach_check(net, prog); in netns_bpf_prog_attach() 333 if (attached == prog) { in netns_bpf_prog_attach() 342 WRITE_ONCE(run_array->items[0].prog, prog); in netns_bpf_prog_attach() 349 run_array->items[0].prog = prog; in netns_bpf_prog_attach() 353 net->bpf.progs[type] = prog; in netns_bpf_prog_attach() [all …]
|
D | cpumap.c | 69 struct bpf_prog *prog; member 155 if (rcpu->prog) in put_cpu_map_entry() 156 bpf_prog_put(rcpu->prog); in put_cpu_map_entry() 191 act = bpf_prog_run_generic_xdp(skb, &xdp, rcpu->prog); in cpu_map_bpf_prog_run_skb() 198 rcpu->prog); in cpu_map_bpf_prog_run_skb() 207 bpf_warn_invalid_xdp_action(NULL, rcpu->prog, act); in cpu_map_bpf_prog_run_skb() 210 trace_xdp_exception(skb->dev, rcpu->prog, act); in cpu_map_bpf_prog_run_skb() 243 act = bpf_prog_run_xdp(rcpu->prog, &xdp); in cpu_map_bpf_prog_run_xdp() 257 rcpu->prog); in cpu_map_bpf_prog_run_xdp() 266 bpf_warn_invalid_xdp_action(NULL, rcpu->prog, act); in cpu_map_bpf_prog_run_xdp() [all …]
|
D | verifier.c | 277 const struct bpf_prog *prog; in find_linfo() local 280 prog = env->prog; in find_linfo() 281 nr_linfo = prog->aux->nr_linfo; in find_linfo() 283 if (!nr_linfo || insn_off >= prog->len) in find_linfo() 286 linfo = prog->aux->linfo; in find_linfo() 406 ltrim(btf_name_by_offset(env->prog->aux->btf, in verbose_linfo() 1866 int insn_cnt = env->prog->len; in add_subprog() 1931 find_kfunc_desc(const struct bpf_prog *prog, u32 func_id, u16 offset) in find_kfunc_desc() argument 1939 tab = prog->aux->kfunc_tab; in find_kfunc_desc() 1954 tab = env->prog->aux->kfunc_btf_tab; in __find_kfunc_desc_btf() [all …]
|
D | map_iter.c | 48 struct bpf_prog *prog; in DEFINE_BPF_ITER_FUNC() local 54 prog = bpf_iter_get_info(&meta, in_stop); in DEFINE_BPF_ITER_FUNC() 55 if (prog) in DEFINE_BPF_ITER_FUNC() 56 ret = bpf_iter_run_prog(prog, &ctx); in DEFINE_BPF_ITER_FUNC() 101 static int bpf_iter_attach_map(struct bpf_prog *prog, in bpf_iter_attach_map() argument 126 key_acc_size = prog->aux->max_rdonly_access; in bpf_iter_attach_map() 127 value_acc_size = prog->aux->max_rdwr_access; in bpf_iter_attach_map()
|
D | task_iter.c | 201 struct bpf_prog *prog; in DEFINE_BPF_ITER_FUNC() local 204 prog = bpf_iter_get_info(&meta, in_stop); in DEFINE_BPF_ITER_FUNC() 205 if (!prog) in DEFINE_BPF_ITER_FUNC() 210 return bpf_iter_run_prog(prog, &ctx); in DEFINE_BPF_ITER_FUNC() 226 static int bpf_iter_attach_task(struct bpf_prog *prog, in bpf_iter_attach_task() argument 378 struct bpf_prog *prog; in DEFINE_BPF_ITER_FUNC() local 381 prog = bpf_iter_get_info(&meta, in_stop); in DEFINE_BPF_ITER_FUNC() 382 if (!prog) in DEFINE_BPF_ITER_FUNC() 389 return bpf_iter_run_prog(prog, &ctx); in DEFINE_BPF_ITER_FUNC() 640 struct bpf_prog *prog; in DEFINE_BPF_ITER_FUNC() local [all …]
|
D | bpf_struct_ops.c | 407 struct bpf_prog *prog; in bpf_struct_ops_map_update_elem() local 457 prog = bpf_prog_get(prog_fd); in bpf_struct_ops_map_update_elem() 458 if (IS_ERR(prog)) { in bpf_struct_ops_map_update_elem() 459 err = PTR_ERR(prog); in bpf_struct_ops_map_update_elem() 463 if (prog->type != BPF_PROG_TYPE_STRUCT_OPS || in bpf_struct_ops_map_update_elem() 464 prog->aux->attach_btf_id != st_ops->type_id || in bpf_struct_ops_map_update_elem() 465 prog->expected_attach_type != i) { in bpf_struct_ops_map_update_elem() 466 bpf_prog_put(prog); in bpf_struct_ops_map_update_elem() 473 bpf_prog_put(prog); in bpf_struct_ops_map_update_elem() 478 &bpf_struct_ops_link_lops, prog); in bpf_struct_ops_map_update_elem() [all …]
|
D | link_iter.c | 48 struct bpf_prog *prog; in DEFINE_BPF_ITER_FUNC() local 54 prog = bpf_iter_get_info(&meta, in_stop); in DEFINE_BPF_ITER_FUNC() 55 if (prog) in DEFINE_BPF_ITER_FUNC() 56 ret = bpf_iter_run_prog(prog, &ctx); in DEFINE_BPF_ITER_FUNC()
|
D | inode.c | 561 struct bpf_prog *prog; in __get_prog_inode() local 573 prog = inode->i_private; in __get_prog_inode() 575 ret = security_bpf_prog(prog); in __get_prog_inode() 579 if (!bpf_prog_get_ok(prog, &type, false)) in __get_prog_inode() 582 bpf_prog_inc(prog); in __get_prog_inode() 583 return prog; in __get_prog_inode() 588 struct bpf_prog *prog; in bpf_prog_get_type_path() local 593 prog = __get_prog_inode(d_backing_inode(path.dentry), type); in bpf_prog_get_type_path() 594 if (!IS_ERR(prog)) in bpf_prog_get_type_path() 597 return prog; in bpf_prog_get_type_path()
|
D | cgroup_iter.c | 126 struct bpf_prog *prog; in __cgroup_iter_seq_show() local 136 prog = bpf_iter_get_info(&meta, in_stop); in __cgroup_iter_seq_show() 137 if (prog) in __cgroup_iter_seq_show() 138 ret = bpf_iter_run_prog(prog, &ctx); in __cgroup_iter_seq_show() 194 static int bpf_iter_attach_cgroup(struct bpf_prog *prog, in bpf_iter_attach_cgroup() argument
|
D | helpers.c | 1091 struct bpf_prog *prog; member 1182 t->prog = NULL; in BPF_CALL_3() 1218 struct bpf_prog *prev, *prog = aux->prog; in BPF_CALL_3() local 1239 prev = t->prog; in BPF_CALL_3() 1240 if (prev != prog) { in BPF_CALL_3() 1244 prog = bpf_prog_inc_not_zero(prog); in BPF_CALL_3() 1245 if (IS_ERR(prog)) { in BPF_CALL_3() 1246 ret = PTR_ERR(prog); in BPF_CALL_3() 1252 t->prog = prog; in BPF_CALL_3() 1279 if (!t || !t->prog) { in BPF_CALL_3() [all …]
|
D | devmap.c | 844 struct bpf_prog *prog = NULL; in __dev_map_alloc_node() local 858 prog = bpf_prog_get_type_dev(val->bpf_prog.fd, in __dev_map_alloc_node() 860 if (IS_ERR(prog)) in __dev_map_alloc_node() 862 if (prog->expected_attach_type != BPF_XDP_DEVMAP || in __dev_map_alloc_node() 863 !bpf_prog_map_compatible(&dtab->map, prog)) in __dev_map_alloc_node() 869 if (prog) { in __dev_map_alloc_node() 870 dev->xdp_prog = prog; in __dev_map_alloc_node() 871 dev->val.bpf_prog.id = prog->aux->id; in __dev_map_alloc_node() 880 bpf_prog_put(prog); in __dev_map_alloc_node()
|
D | bpf_fuse.c | 8 fuse_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) in fuse_prog_func_proto() argument 34 const struct bpf_prog *prog, in fuse_prog_is_valid_access() argument
|
D | btf.c | 5334 struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog) in bpf_prog_get_target_btf() argument 5336 struct bpf_prog *tgt_prog = prog->aux->dst_prog; in bpf_prog_get_target_btf() 5341 return prog->aux->attach_btf; in bpf_prog_get_target_btf() 5381 const struct bpf_prog *prog, in btf_ctx_access() argument 5384 const struct btf_type *t = prog->aux->attach_func_proto; in btf_ctx_access() 5385 struct bpf_prog *tgt_prog = prog->aux->dst_prog; in btf_ctx_access() 5386 struct btf *btf = bpf_prog_get_target_btf(prog); in btf_ctx_access() 5387 const char *tname = prog->aux->attach_func_name; in btf_ctx_access() 5405 if (prog->aux->attach_btf_trace) { in btf_ctx_access() 5418 switch (prog->expected_attach_type) { in btf_ctx_access() [all …]
|
/kernel/trace/ |
D | trace_events_filter.c | 154 static void update_preds(struct prog_entry *prog, int N, int invert) in update_preds() argument 158 t = prog[N].target; in update_preds() 159 s = prog[t].target; in update_preds() 160 prog[t].when_to_branch = invert; in update_preds() 161 prog[t].target = N; in update_preds() 162 prog[N].target = s; in update_preds() 452 struct prog_entry *prog; in predicate_parse() local 480 prog = prog_stack; in predicate_parse() 511 prog[N].target = N-1; in predicate_parse() 513 len = parse_pred(next, data, ptr - str, pe, &prog[N].pred); in predicate_parse() [all …]
|
D | bpf_trace.c | 954 static bool bpf_d_path_allowed(const struct bpf_prog *prog) in BTF_ID() 956 if (prog->type == BPF_PROG_TYPE_TRACING && in BTF_ID() 957 prog->expected_attach_type == BPF_TRACE_ITER) in BTF_ID() 960 if (prog->type == BPF_PROG_TYPE_LSM) in BTF_ID() 961 return bpf_lsm_is_sleepable_hook(prog->aux->attach_btf_id); in BTF_ID() 964 prog->aux->attach_btf_id); in BTF_ID() 1405 bpf_tracing_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) in bpf_tracing_func_proto() argument 1502 return prog->aux->sleepable ? &bpf_copy_from_user_proto : NULL; in bpf_tracing_func_proto() 1504 return prog->aux->sleepable ? &bpf_copy_from_user_task_proto : NULL; in bpf_tracing_func_proto() 1533 kprobe_prog_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog) in kprobe_prog_func_proto() argument [all …]
|
/kernel/bpf/preload/iterators/ |
D | iterators.bpf.c | 55 struct bpf_prog *prog; member 98 struct bpf_prog *prog = ctx->prog; in dump_bpf_prog() local 101 if (!prog) in dump_bpf_prog() 104 aux = prog->aux; in dump_bpf_prog()
|