Function report |
Source Code:kernel\bpf\verifier.c |
Create Date:2022-07-28 13:00:03 |
| Last Modify:2022-05-19 20:02:10 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:check_helper_call
Proto:static int check_helper_call(struct bpf_verifier_env *env, int func_id, int insn_idx)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct bpf_verifier_env * | env | |
| int | func_id | |
| int | insn_idx |
| 4182 | const struct bpf_func_proto * fn = NULL |
| 4189 | If func_id < 0 || func_id >= __BPF_FUNC_MAX_ID Then |
| 4195 | If get_func_proto Then fn = get_func_proto(func_id, BPF program being verified ) |
| 4197 | If Not fn Then |
| 4204 | If Not Is filter GPL compatible? && gpl_only Then |
| 4206 | Return -EINVAL |
| 4211 | If changes_data && arg1_type != pointer to context Then |
| 4212 | verbose(env, "kernel subsystem misconfigured func %s#%d: r1 != ctx\n", func_id_name(func_id), func_id) |
| 4214 | Return -EINVAL |
| 4218 | pkt_access = pkt_access |
| 4220 | err = check_func_proto(fn, func_id) |
| 4221 | If err Then |
| 4222 | verbose(env, "kernel subsystem misconfigured func %s#%d\n", func_id_name(func_id), func_id) |
| 4224 | Return err |
| 4230 | err = btf_resolve_helper_id( & log, fn, i) |
| 4249 | When i < access_size cycle |
| 4256 | If func_id == BPF_FUNC_tail_call Then |
| 4257 | err = check_reference_leak(env) |
| 4258 | If err Then |
| 4263 | err = The pointer with the specified id has released its reference to kernel* resources. Identify all copies of the same pointer and clear the reference. |
| 4264 | If err Then |
| 4276 | If func_id == BPF_FUNC_get_local_storage && Not Does this register contain a constant zero? Then |
| 4283 | When i < CALLER_SAVED_REGS cycle |
| 4284 | mark_reg_not_init(env, regs, caller_saved[i]) |
| 4285 | check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK) |
| 4292 | If ret_type == RET_INTEGER Then |
| 4294 | mark_reg_unknown(env, regs, BPF_REG_0) |
| 4297 | Else if ret_type == RET_PTR_TO_MAP_VALUE_OR_NULL || ret_type == RET_PTR_TO_MAP_VALUE Then |
| 4300 | mark_reg_known_zero(env, regs, BPF_REG_0) |
| 4305 | If (map_ptr == NULL) Then |
| 4311 | If ret_type == RET_PTR_TO_MAP_VALUE Then |
| 4315 | Else |
| 4319 | Else if ret_type == RET_PTR_TO_SOCKET_OR_NULL Then |
| 4320 | mark_reg_known_zero(env, regs, BPF_REG_0) |
| 4323 | Else if ret_type == RET_PTR_TO_SOCK_COMMON_OR_NULL Then |
| 4324 | mark_reg_known_zero(env, regs, BPF_REG_0) |
| 4327 | Else if ret_type == RET_PTR_TO_TCP_SOCK_OR_NULL Then |
| 4328 | mark_reg_known_zero(env, regs, BPF_REG_0) |
| 4331 | Else |
| 4332 | verbose(env, "unknown return type %d of func %s#%d\n", ret_type, func_id_name(func_id), func_id) |
| 4334 | Return -EINVAL |
| 4337 | If is_ptr_cast_function(func_id) Then |
| 4340 | Else if is_acquire_function(func_id) Then |
| 4351 | do_refine_retval_range(regs, ret_type, func_id, & meta) |
| 4353 | err = check_map_func_compatibility(env, map_ptr, func_id) |
| 4357 | If func_id == BPF_FUNC_get_stack && Not callchain buffer allocated? Then |
| 4364 | err = -Operation is not supported |
| 4365 | err_str = "func %s#%d not supported without CONFIG_PERF_EVENTS\n" |
| 4367 | If err Then |
| 4372 | callchain buffer allocated? = true |
| 4375 | If changes_data Then clear_all_pkt_pointers(env) |
| 4377 | Return 0 |
| Name | Describe |
|---|---|
| do_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 |