Function report | 
Source Code:kernel\bpf\verifier.c | 
Create Date:2022-07-28 13:04:58 | 
| Last Modify:2022-05-19 20:02:10 | Copyright©Brick | 
| home page | Tree | 
| Annotation kernel can get tool activity | Download SCCT | Chinese | 
Name:jit_subprogs
Proto:static int jit_subprogs(struct bpf_verifier_env *env)
Type:int
Parameter:
| Type | Parameter | Name | 
|---|---|---|
| struct bpf_verifier_env * | env | 
| 8928 | prog = BPF program being verified | 
| 8929 | subprog_end = 0 | 
| 8934 | If subprog_cnt <= 1 Then Return 0 | 
| 8937 | When i < Number of filter blocks cycle | 
| 8938 | If opcode != (BPF_JMP | unction call ) || source register != when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function Then Continue | 
| 8945 | subprog = find_subprog(env, i + signed immediate constant + 1) | 
| 8946 | If subprog < 0 Then | 
| 8947 | WARN_ONCE(1, "verifier bug. No program starts at insn %d\n", i + signed immediate constant + 1) | 
| 8949 | Return -EFAULT | 
| 8954 | signed offset = subprog | 
| 8960 | signed immediate constant = 1 | 
| 8963 | err = bpf_prog_alloc_jited_linfo(prog) | 
| 8964 | If err Then Go to out_undo_insn | 
| 8968 | func = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc). | 
| 8969 | If Not func Then Go to out_undo_insn | 
| 8972 | When i < subprog_cnt cycle | 
| 8973 | subprog_start = subprog_end | 
| 8976 | len = subprog_end - subprog_start | 
| 8982 | func[i] = bpf_prog_alloc_no_stats(bpf_prog_size(len), GFP_USER) | 
| 8985 | No 3D Now!(insnsi, & insnsi[subprog_start], len * sizeof(structbpf_insn)) | 
| 8988 | Number of filter blocks = len | 
| 8989 | If bpf_prog_calc_tag(func[i]) Then Go to out_free | 
| 8991 | program is a bpf function = 1 | 
| 9000 | name[0] = 'F' | 
| 9002 | archs need to JIT the prog = 1 | 
| 9006 | subprog can use linfo_idx to access its first linfo and * jited_linfo. * main prog always has linfo_idx == 0 = The idx to the main_prog->aux->linfo | 
| 9007 | func[i] = Stub for JITs that only support cBPF. eBPF programs are interpreted.* It is encouraged to implement bpf_int_jit_compile() instead, so that* eBPF and implicitly also cBPF can get JITed! | 
| 9008 | If Not Is our filter JIT'ed? Then | 
| 9009 | err = -Operation is not supported | 
| 9010 | Go to out_free | 
| 9012 | cond_resched() | 
| 9018 | When i < subprog_cnt cycle | 
| 9020 | When j < Number of filter blocks cycle | 
| 9021 | If opcode != (BPF_JMP | unction call ) || source register != when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function Then Continue | 
| 9024 | subprog = signed offset | 
| 9043 | When i < subprog_cnt cycle | 
| 9044 | old_bpf_func = bpf_func | 
| 9045 | tmp = Stub for JITs that only support cBPF. eBPF programs are interpreted.* It is encouraged to implement bpf_int_jit_compile() instead, so that* eBPF and implicitly also cBPF can get JITed! | 
| 9046 | If tmp != func[i] || bpf_func != old_bpf_func Then | 
| 9048 | err = -Operation is not supported | 
| 9049 | Go to out_free | 
| 9051 | cond_resched() | 
| 9057 | When i < subprog_cnt cycle | 
| 9058 | bpf_prog_lock_ro(func[i]) | 
| 9059 | bpf_prog_kallsyms_add(func[i]) | 
| 9066 | When i < Number of filter blocks cycle | 
| 9067 | If opcode != (BPF_JMP | unction call ) || source register != when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function Then Continue | 
| 9071 | subprog = find_subprog(env, i + signed offset + 1) | 
| 9072 | signed immediate constant = subprog | 
| 9075 | Is our filter JIT'ed? = 1 | 
| 9080 | Return 0 | 
| 9081 | out_free : | 
| 9082 | When i < subprog_cnt cycle If func[i] Then | 
| 9084 | bpf_jit_free(func[i]) | 
| 9086 | out_undo_insn : | 
| 9088 | archs need to JIT the prog = 0 | 
| 9089 | When i < Number of filter blocks cycle | 
| 9090 | If opcode != (BPF_JMP | unction call ) || source register != when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function Then Continue | 
| 9093 | signed offset = 0 | 
| 9097 | Return err | 
| Name | Describe | 
|---|---|
| fixup_call_args | 
| 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  |