函数逻辑报告 |
Source Code:kernel\bpf\verifier.c |
Create Date:2022-07-27 14:16:48 |
Last Modify:2022-05-19 20:02:10 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:-recursive depth-first-search to detect loops in BPF program* loop == back-edge in directed graph
函数原型:static int check_cfg(struct bpf_verifier_env *env)
返回类型:int
参数:
类型 | 参数 | 名称 |
---|---|---|
struct bpf_verifier_env * | env |
6539 | insn_cnt等于 Number of filter blocks |
6541 | ret等于0 |
6544 | insn_state等于insn_state等于kvcalloc(insn_cnt, sizeof(int), GFP_KERNEL) |
6545 | 如果非insn_state则返回:负ENOMEM |
6548 | insn_stack等于insn_stack等于kvcalloc(insn_cnt, sizeof(int), GFP_KERNEL) |
6549 | 如果非insn_stack则 |
6550 | kvfree(insn_state) |
6551 | 返回:负ENOMEM |
6554 | insn_state[0]等于DISCOVERED |
6555 | insn_stack[0]等于0 |
6556 | cur_stack等于1 |
6558 | peek_stack : |
6559 | 如果cur_stack恒等于0则转到:check_state |
6561 | t等于insn_stack[cur_stack - 1] |
6563 | 如果Instruction classes ( opcode )恒等于BPF_JMP或Instruction classes ( opcode )恒等于jmp mode in word width 则 |
6565 | opcode等于alu/jmp fields ( opcode ) |
6567 | 如果opcode恒等于unction return 则 |
6568 | 转到:mark_explored |
6569 | 否则如果opcode恒等于unction call 则 |
6571 | 如果ret恒等于1则转到:peek_stack |
6575 | 如果t加1小于insn_cnt则init_explored_state(env, t + 1) |
6578 | init_explored_state(env, t) |
6581 | 如果ret恒等于1则转到:peek_stack |
6594 | 如果ret恒等于1则转到:peek_stack |
6602 | init_explored_state(env, t + signed offset + 1) |
6606 | 如果t加1小于insn_cnt则init_explored_state(env, t + 1) |
6608 | 否则 |
6623 | 否则 |
6628 | 如果ret恒等于1则转到:peek_stack |
6634 | mark_explored : |
6635 | insn_state[t]等于EXPLORED |
6636 | 如果cur_stack自减小于等于0则 |
6641 | 转到:peek_stack |
6643 | check_state : |
6645 | 如果insn_state[i]不等于EXPLORED则 |
6651 | ret等于0 |
6653 | err_free : |
6654 | kvfree(insn_state) |
6655 | kvfree(insn_stack) |
6656 | insn_state = insn_stack = NULL |
6657 | 返回:ret |
名称 | 描述 |
---|---|
bpf_check |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |