函数逻辑报告 |
Source Code:kernel\bpf\verifier.c |
Create Date:2022-07-27 14:21:03 |
Last Modify:2022-05-19 20:02:10 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:bpf_check
函数原型:int bpf_check(struct bpf_prog **prog, union bpf_attr *attr, union bpf_attr __user *uattr)
返回类型:int
参数:
类型 | 参数 | 名称 |
---|---|---|
struct bpf_prog ** | prog | |
union bpf_attr * | attr | |
union bpf_attr __user * | uattr |
9677 | start_time等于ktime_get_ns() |
9684 | 如果ARRAY_SIZE - get the number of elements in array @arr*@arr: array to be sized(bpf_verifier_ops)恒等于0则返回:负EINVAL |
9695 | len等于 Number of filter blocks |
9699 | 如果非array of per-insn state 则转到:err_free_env |
9701 | 以i小于len循环 original instruction index 等于i |
9703 | BPF program being verified 等于prog |
9704 | ops等于bpf_verifier_ops[ Type of BPF program ] |
9708 | mutex_lock( & bpf_verifier_lock) |
9709 | 如果非btf_vmlinux则btf_vmlinux等于btf_parse_vmlinux() |
9715 | 如果非is_priv则mutex_lock( & bpf_verifier_lock) |
9718 | 如果 verbosity level of verifier 或log_buf或 size of user buffer 则 |
9722 | level等于 verbosity level of verifier |
9724 | len_total等于 size of user buffer |
9728 | 如果len_total小于128或len_total大于UINT_MAX右移2位或非level或非ubuf或level按位与BPF_LOG_MASK的反则转到:err_unlock |
9733 | 如果是错误则 |
9740 | ret等于check_attach_btf_id(env) |
9741 | 如果ret则转到:skip_full_check |
9745 | 如果非IS_ENABLED(CONFIG_FOO) evaluates to 1 if CONFIG_FOO is set to 'y' or 'm',* 0 otherwise.(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)则perform strict pointer alignment checks = true |
9750 | allow_ptr_leaks等于is_priv |
9752 | 如果is_priv则st verifier with different pruning frequency 等于prog_flags按位与The verifier internal test flag. Behavior is undefined |
9755 | ret等于look for pseudo eBPF instructions that access map FDs and* replace them with actual map pointers |
9756 | 如果ret小于0则转到:skip_full_check |
9759 | 如果bpf_prog_is_dev_bound( Auxiliary fields )则 |
9761 | 如果ret则转到:skip_full_check |
9765 | search pruning optimization 等于kvcalloc(state_htab_size(env), *的长度, GFP_USER) |
9769 | 如果非search pruning optimization 则转到:skip_full_check |
9772 | ret等于check_subprogs(env) |
9773 | 如果ret小于0则转到:skip_full_check |
9776 | ret等于check_btf_info(env, attr, uattr) |
9777 | 如果ret小于0则转到:skip_full_check |
9780 | ret等于-recursive depth-first-search to detect loops in BPF program* loop == back-edge in directed graph |
9781 | 如果ret小于0则转到:skip_full_check |
9785 | 如果current verifier state 则 |
9786 | free_verifier_state(current verifier state , true) |
9787 | current verifier state = NULL |
9790 | 如果ret恒等于0且bpf_prog_is_dev_bound( Auxiliary fields )则ret等于bpf_prog_offload_finalize(env) |
9793 | skip_full_check : |
9795 | free_states(env) |
9797 | 如果ret恒等于0则ret等于starting from main bpf function walk all instructions of the function* and recursively walk all callees that given function can call |
9801 | 如果is_priv则 |
9802 | 如果ret恒等于0则opt_hard_wire_dead_code_branches(env) |
9804 | 如果ret恒等于0则ret等于opt_remove_dead_code(env) |
9806 | 如果ret恒等于0则ret等于opt_remove_nops(env) |
9808 | 否则 |
9817 | 如果ret恒等于0则ret等于xup insn->imm field of bpf_call instructions* and inline eligible helpers as explicit sequence of BPF instructions* this function is called after eBPF program passed verification |
9823 | 如果ret恒等于0且非bpf_prog_is_dev_bound( Auxiliary fields )则 |
9824 | ret等于opt_subreg_zext_lo32_rnd_hi32(env, attr) |
9829 | 如果ret恒等于0则ret等于fixup_call_args(env) |
9832 | al verification time 等于ktime_get_ns()减start_time |
9833 | print_verification_stats(env) |
9835 | 如果level且bpf_verifier_log_full(log)则ret等于负ENOSPC |
9839 | 转到:err_release_maps |
9842 | 如果ret恒等于0且umber of used maps 则 |
9848 | 如果非used_maps则 |
9850 | 转到:err_release_maps |
9863 | 如果ret恒等于0则adjust_btf_func(env) |
9866 | err_release_maps : |
9873 | err_unlock : |
9876 | vfree(array of per-insn state ) |
9877 | err_free_env : |
9879 | 返回:ret |
名称 | 描述 |
---|---|
bpf_prog_load |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |