Function report |
Source Code:kernel\bpf\verifier.c |
Create Date:2022-07-28 13:04:02 |
Last Modify:2022-05-19 20:02:10 | Copyright©Brick |
home page | Tree |
Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:look for pseudo eBPF instructions that access map FDs and* replace them with actual map pointers
Proto:static int replace_map_fd_with_map_ptr(struct bpf_verifier_env *env)
Type:int
Parameter:
Type | Parameter | Name |
---|---|---|
struct bpf_verifier_env * | env |
8167 | insn_cnt = Number of filter blocks |
8175 | If Instruction classes ( opcode ) == BPF_LDX && ( BPF BPF_DW 0x18 64-bit ( opcode ) != BPF_MEM || signed immediate constant != 0 ) Then |
8181 | If Instruction classes ( opcode ) == BPF_STX && ( BPF BPF_DW 0x18 64-bit ( opcode ) != BPF_MEM && BPF BPF_DW 0x18 64-bit ( opcode ) != xclusive add || signed immediate constant != 0 ) Then |
8188 | If opcode == ( BPF_LD | BPF_IMM | double word (64-bit) ) Then |
8194 | If i == insn_cnt - 1 || opcode != 0 || dest register != 0 || source register != 0 || signed offset != 0 Then |
8201 | If source register == 0 Then Go to next_insn |
8208 | If source register != When BPF ldimm64's insn[0] && source register != BPF_PSEUDO_MAP_VALUE || source register == When BPF ldimm64's insn[0] && signed immediate constant != 0 Then |
8217 | f = fdget( signed immediate constant ) |
8218 | map = error is returned, fd is released.* On success caller should complete fd access with matching fdput() |
8220 | verbose(env, "fd %d is not pointing to valid bpf_map\n", signed immediate constant ) |
8226 | If err Then |
8231 | aux = array of per-insn state [i] |
8232 | If source register == When BPF ldimm64's insn[0] Then |
8234 | Else |
8235 | off = signed immediate constant |
8240 | Return -EINVAL |
8243 | If Not map_direct_value_addr Then |
8246 | Return -EINVAL |
8249 | err = map_direct_value_addr(map, & addr, off) |
8250 | If err Then |
8251 | verbose(env, "invalid access to map value pointer, value_size=%u off=%u\n", value_size, off) |
8254 | Return err |
8261 | signed immediate constant = addr |
8262 | signed immediate constant = addr >> 32 |
8265 | When j < umber of used maps cycle |
8266 | If array of map's used by eBPF program [j] == map Then |
8273 | If umber of used maps >= max number of maps accessed by one eBPF program Then |
8283 | bpf_map_inc(map) |
8286 | array of map's used by eBPF program [umber of used maps ++] = map |
8288 | If bpf_map_is_cgroup_storage(map) && bpf_cgroup_storage_assign( Auxiliary fields , map) Then |
8292 | Return -EBUSY |
8296 | next_insn : |
8297 | insn++ |
8298 | i++ |
8299 | Continue |
8303 | If Not bpf_opcode_in_insntable( opcode ) Then |
8313 | Return 0 |
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 |