Function report |
Source Code:kernel\bpf\verifier.c |
Create Date:2022-07-28 13:05:46 |
Last Modify:2022-05-19 20:02:10 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:check_attach_btf_id
Proto:static int check_attach_btf_id(struct bpf_verifier_env *env)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct bpf_verifier_env * | env |
9518 | prog = BPF program being verified |
9519 | tgt_prog = linked_prog |
9521 | prefix[] = "btf_trace_" |
9525 | bool conservative = true |
9531 | If Type of BPF program != BPF_PROG_TYPE_TRACING Then Return 0 |
9534 | If Not btf_id Then |
9538 | btf = bpf_prog_get_target_btf(prog) |
9539 | If Not btf Then |
9540 | verbose(env, "FENTRY/FEXIT program can only be attached to another program annotated with BTF\n") |
9542 | Return -EINVAL |
9544 | t = btf_type_by_id(btf, btf_id) |
9545 | If Not t Then |
9549 | tname = btf_name_by_offset(btf, name_off) |
9550 | If Not tname Then |
9554 | If tgt_prog Then |
9555 | aux = Auxiliary fields |
9557 | When i < func_info_cnt cycle If type_id == btf_id Then |
9562 | If subprog == -1 Then |
9566 | conservative = unreliable |
9568 | Else |
9573 | Case For some prog types == BPF_TRACE_RAW_TP |
9574 | If tgt_prog Then |
9577 | Return -EINVAL |
9579 | If Not btf_type_is_typedef(t) Then |
9587 | Return -EINVAL |
9590 | t = btf_type_by_id(btf, type) |
9591 | If Not btf_type_is_ptr(t) Then Return -EINVAL |
9594 | t = btf_type_by_id(btf, type) |
9595 | If Not btf_type_is_func_proto(t) Then Return -EINVAL |
9604 | true if attaching to BTF-enabled raw tp = true |
9605 | Return 0 |
9606 | Case For some prog types == BPF_TRACE_FENTRY |
9607 | Case For some prog types == BPF_TRACE_FEXIT |
9608 | If Not btf_type_is_func(t) Then |
9613 | t = btf_type_by_id(btf, type) |
9614 | If Not btf_type_is_func_proto(t) Then Return -EINVAL |
9616 | tr = bpf_trampoline_lookup(key) |
9623 | If addr Then |
9624 | trampoline = tr |
9625 | Go to out |
9627 | If tgt_prog && conservative Then |
9628 | BTF_KIND_FUNC_PROTO for valid attach_btf_id = NULL |
9629 | t = NULL |
9635 | If tgt_prog Then |
9636 | If Not Is our filter JIT'ed? Then |
9642 | If Type of BPF program == BPF_PROG_TYPE_TRACING Then |
9652 | Else |
9654 | If Not addr Then |
9663 | trampoline = tr |
9664 | out : |
9666 | If ret Then bpf_trampoline_put(tr) |
9668 | Return ret |
9669 | Default |
9670 | Return -EINVAL |
Name | Describe |
---|---|
bpf_check |
Source code conversion tool public plug-in interface | X |
---|---|
Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |