函数逻辑报告 |
Source Code:kernel\bpf\disasm.c |
Create Date:2022-07-27 14:32:36 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| 首页 | 函数Tree |
| 注解内核,赢得工具 | 下载SCCT | English |
函数名称:print_bpf_insn
函数原型:void print_bpf_insn(const struct bpf_insn_cbs *cbs, const struct bpf_insn *insn, bool allow_ptr_leaks)
返回类型:void
参数:
| 类型 | 参数 | 名称 |
|---|---|---|
| const struct bpf_insn_cbs * | cbs | |
| const struct bpf_insn * | insn | |
| bool | allow_ptr_leaks |
| 122 | class等于Instruction classes ( opcode ) |
| 124 | 如果class恒等于BPF_ALU或class恒等于alu mode in double word width 则 |
| 125 | 如果alu/jmp fields ( opcode )恒等于lags for endianness conversion: 则 |
| 126 | 如果class恒等于alu mode in double word width 则verbose(private_data, "BUG_alu64_%02x\n", opcode ) |
| 128 | 否则print_bpf_end_insn(verbose, private_data, insn) |
| 130 | 否则如果alu/jmp fields ( opcode )恒等于BPF_NEG则 |
| 131 | verbose(private_data, "(%02x) %c%d = -%c%d\n", opcode , class == BPF_ALU ? 'w' : 'r', dest register , class == BPF_ALU ? 'w' : 'r', dest register ) |
| 136 | verbose(private_data, "(%02x) %c%d %s %c%d\n", opcode , class == BPF_ALU ? 'w' : 'r', dest register , bpf_alu_string[alu/jmp fields ( opcode ) >> 4], class == BPF_ALU ? 'w' : 'r', source register ) |
| 142 | 否则 |
| 143 | verbose(private_data, "(%02x) %c%d %s %d\n", opcode , class == BPF_ALU ? 'w' : 'r', dest register , bpf_alu_string[alu/jmp fields ( opcode ) >> 4], signed immediate constant ) |
| 150 | 如果BPF BPF_DW 0x18 64-bit ( opcode )恒等于BPF_MEM则verbose(private_data, "(%02x) *(%s *)(r%d %+d) = r%d\n", opcode , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], dest register , signed offset , source register ) |
| 156 | 否则如果BPF BPF_DW 0x18 64-bit ( opcode )恒等于xclusive add 则verbose(private_data, "(%02x) lock *(%s *)(r%d %+d) += r%d\n", opcode , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], dest register , signed offset , source register ) |
| 162 | 否则verbose(private_data, "BUG_%02x\n", opcode ) |
| 165 | 如果BPF BPF_DW 0x18 64-bit ( opcode )不等于BPF_MEM则 |
| 166 | verbose(private_data, "BUG_st_%02x\n", opcode ) |
| 167 | 返回 |
| 169 | verbose(private_data, "(%02x) *(%s *)(r%d %+d) = %d\n", opcode , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], dest register , signed offset , signed immediate constant ) |
| 175 | 如果BPF BPF_DW 0x18 64-bit ( opcode )不等于BPF_MEM则 |
| 176 | verbose(private_data, "BUG_ldx_%02x\n", opcode ) |
| 177 | 返回 |
| 179 | verbose(private_data, "(%02x) r%d = *(%s *)(r%d %+d)\n", opcode , dest register , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], source register , signed offset ) |
| 184 | 如果BPF BPF_DW 0x18 64-bit ( opcode )恒等于BPF_ABS则 |
| 185 | verbose(private_data, "(%02x) r0 = *(%s *)skb[%d]\n", opcode , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], signed immediate constant ) |
| 189 | 否则如果BPF BPF_DW 0x18 64-bit ( opcode )恒等于BPF_IND则 |
| 190 | verbose(private_data, "(%02x) r0 = *(%s *)skb[r%d + %d]\n", opcode , bpf_ldst_string[ld/ldx fields ( opcode ) >> 3], source register , signed immediate constant ) |
| 194 | 否则如果BPF BPF_DW 0x18 64-bit ( opcode )恒等于BPF_IMM且ld/ldx fields ( opcode )恒等于double word (64-bit) 则 |
| 199 | imm等于 signed immediate constant 左移32位按位或 signed immediate constant |
| 204 | 如果is_ptr且非allow_ptr_leaks则imm等于0 |
| 207 | verbose(private_data, "(%02x) r%d = %s\n", opcode , dest register , __func_imm_name(cbs, insn, imm, tmp, tmp的长度)) |
| 211 | 否则 |
| 212 | verbose(private_data, "BUG_ld_%02x\n", opcode ) |
| 213 | 返回 |
| 215 | 否则如果class恒等于jmp mode in word width 或class恒等于BPF_JMP则 |
| 216 | opcode等于alu/jmp fields ( opcode ) |
| 218 | 如果opcode恒等于unction call 则 |
| 222 | verbose(private_data, "(%02x) call pc%s\n", opcode , __func_get_name(cbs, insn, tmp, tmp的长度)) |
| 226 | 否则 |
| 228 | verbose(private_data, "(%02x) call %s#%d\n", opcode , __func_get_name(cbs, insn, tmp, tmp的长度), signed immediate constant ) |
| 234 | verbose(private_data, "(%02x) goto pc%+d\n", opcode , signed offset ) |
| 236 | 否则如果 opcode 恒等于BPF_JMP按位或unction return 的值则 |
| 237 | verbose(private_data, "(%02x) exit\n", opcode ) |
| 239 | verbose(private_data, "(%02x) if %c%d %s %c%d goto pc%+d\n", opcode , class == jmp mode in word width ? 'w' : 'r', dest register , bpf_jmp_string[alu/jmp fields ( opcode ) >> 4], class == jmp mode in word width ? 'w' : 'r', source register , signed offset ) |
| 246 | 否则 |
| 247 | verbose(private_data, "(%02x) if %c%d %s 0x%x goto pc%+d\n", opcode , class == jmp mode in word width ? 'w' : 'r', dest register , bpf_jmp_string[alu/jmp fields ( opcode ) >> 4], signed immediate constant , signed offset ) |
| 254 | 否则 |
| 255 | verbose(private_data, "(%02x) %s\n", opcode , bpf_class_string[class]) |
| 名称 | 描述 |
|---|---|
| do_check | |
| backtrack_insn | For given verifier state backtrack_insn() is called from the last insn to* the first insn. Its purpose is to compute a bitmask of registers and* stack slots that needs precision in the parent verifier state. |
| 源代码转换工具 开放的插件接口 | X |
|---|---|
| 支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |