函数逻辑报告 |
Source Code:kernel\bpf\verifier.c |
Create Date:2022-07-27 14:13:01 |
Last Modify:2022-05-19 20:02:10 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:check_func_arg
函数原型:static int check_func_arg(struct bpf_verifier_env *env, u32 regno, enum bpf_arg_type arg_type, struct bpf_call_arg_meta *meta)
返回类型:int
参数:
类型 | 参数 | 名称 |
---|---|---|
struct bpf_verifier_env * | env | |
u32 | regno | |
enum bpf_arg_type | arg_type | |
struct bpf_call_arg_meta * | meta |
3411 | err等于0 |
3413 | 如果arg_type恒等于unused argument in helper function 则返回:0 |
3420 | 如果arg_type恒等于any (initialized) argument is ok 则 |
3421 | 如果is_pointer_value(env, regno)则 |
3426 | 返回:0 |
3429 | 如果type_is_pkt_pointer(type)且非may_access_direct_pkt_data(env, meta, BPF_READ)则 |
3440 | 如果Does this register contain a constant zero? 且arg_type恒等于pointer to stack used as map value or NULL 则否则如果非type_is_pkt_pointer(type)且type不等于g points to map element value 且type不等于expected_type则 |
3446 | 转到:err_type |
3450 | 如果type不等于expected_type则转到:err_type |
3452 | 否则如果arg_type恒等于const argument used as pointer to bpf_map 则 |
3454 | 如果type不等于expected_type则转到:err_type |
3456 | 否则如果arg_type恒等于pointer to context 则 |
3458 | 如果type不等于expected_type则转到:err_type |
3460 | err等于check_ctx_reg(env, reg, regno) |
3463 | 否则如果arg_type恒等于pointer to sock_common 则 |
3466 | 如果非type_is_sk_pointer(type)则转到:err_type |
3469 | 如果ref_obj_id则 |
3470 | verbose(env, "verifier internal error: more than one arg with ref_obj_id R%d %u %u\n", regno, PTR_TO_SOCKET and PTR_TO_TCP_SOCK could be a ptr returned * from a pointer-cast helper, bpf_sk_fullsock() and * bpf_tcp_sock(). * Consider the following where "sk" is a reference counted * pointer returned from "sk = bpf_sk_lookup_tcp();": * 1: sk = bpf_s, ref_obj_id) |
3473 | 返回:负EFAULT |
3477 | 否则如果arg_type恒等于pointer to bpf_sock (fullsock) 则 |
3479 | 如果type不等于expected_type则转到:err_type |
3481 | 否则如果arg_type恒等于pointer to in-kernel struct 则 |
3483 | 如果type不等于expected_type则转到:err_type |
3485 | 如果 for PTR_TO_BTF_ID 不等于btf_id则 |
3486 | verbose(env, "Helper has type %s got %s in R%d\n", kernel_type_name(btf_id), kernel_type_name( for PTR_TO_BTF_ID ), regno) |
3490 | 返回:负EACCES |
3497 | 否则如果arg_type恒等于pointer to bpf_spin_lock 则 |
3508 | 否则如果arg_type_is_mem_ptr(arg_type)则 |
3514 | 如果Does this register contain a constant zero? 且arg_type恒等于pointer to valid memory or NULL 则否则如果非type_is_pkt_pointer(type)且type不等于g points to map element value 且type不等于expected_type则 |
3520 | 转到:err_type |
3522 | 否则如果arg_type_is_int_ptr(arg_type)则 |
3524 | 如果非type_is_pkt_pointer(type)且type不等于g points to map element value 且type不等于expected_type则转到:err_type |
3528 | 否则 |
3536 | 否则如果arg_type恒等于pointer to stack used as map key 则 |
3541 | 如果非map_ptr则 |
3560 | 如果非map_ptr则 |
3569 | 否则如果arg_type_is_mem_size(arg_type)则 |
3581 | 如果非Returns true if @a is a known constant 则meta = NULL |
3589 | 如果 minimum possible (s64)value 小于0则 |
3592 | 返回:负EACCES |
3595 | 如果 minimum possible (u64)value 恒等于0则 |
3596 | err等于check_helper_mem_access(env, regno - 1, 0, zero_size_allowed, meta) |
3606 | 返回:负EACCES |
3608 | err等于check_helper_mem_access(env, regno - 1, maximum possible (u64)value , zero_size_allowed, meta) |
3611 | 如果非err则err等于mark_chain_precision(env, regno) |
3613 | 否则如果arg_type_is_int_ptr(arg_type)则 |
3614 | size等于int_ptr_type_to_size(arg_type) |
3616 | err等于check_helper_mem_access(env, regno, size, TSC's on different sockets may be reset asynchronously.* This may cause the TSC ADJUST value on socket 0 to be NOT 0., meta) |
3619 | err等于check_ptr_alignment(env, reg, 0, size, true) |
3622 | 返回:err |
3623 | err_type : |
3624 | verbose(env, "R%d type=%s expected=%s\n", regno, string representation of 'enum bpf_reg_type' [type], string representation of 'enum bpf_reg_type' [expected_type]) |
3626 | 返回:负EACCES |
名称 | 描述 |
---|---|
check_helper_call |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |