函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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
注解内核,赢得工具下载SCCTEnglish

函数名称: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
boolallow_ptr_leaks
121  verbose等于cb_print
122  class等于Instruction classes ( opcode )
124  如果class恒等于BPF_ALUclass恒等于alu mode in double word width
126  如果class恒等于alu mode in double word width verbose(private_data, "BUG_alu64_%02x\n", opcode )
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 )
135  否则如果BPF_SRC( opcode )恒等于BPF_X
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  否则
149  否则如果class恒等于BPF_STX
150  如果BPF BPF_DW 0x18 64-bit ( opcode )恒等于BPF_MEMverbose(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 )
164  否则如果class恒等于BPF_ST
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 )
174  否则如果class恒等于BPF_LDX
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 )
183  否则如果class恒等于BPF_LD
184  如果BPF BPF_DW 0x18 64-bit ( opcode )恒等于BPF_ABS
189  否则如果BPF BPF_DW 0x18 64-bit ( opcode )恒等于BPF_IND
204  如果is_ptr且非allow_ptr_leaksimm等于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  否则
227  strcpy(tmp, "unknown")
233  否则如果 opcode 恒等于BPF_JMP按位或BPF_JA的值则
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 )
238  否则如果BPF_SRC( opcode )恒等于BPF_X
246  否则
254  否则
255  verbose(private_data, "(%02x) %s\n", opcode , bpf_class_string[class])
调用者
名称描述
do_check
backtrack_insnFor 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.