Function report |
Source Code:kernel\bpf\verifier.c |
Create Date:2022-07-28 12:57:13 |
| Last Modify:2022-05-19 20:02:10 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name: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.
Proto:static int backtrack_insn(struct bpf_verifier_env *env, int idx, u32 *reg_mask, u64 *stack_mask)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct bpf_verifier_env * | env | |
| int | idx | |
| u32 * | reg_mask | |
| u64 * | stack_mask |
| 1512 | const struct bpf_insn_cbs cbs = {cb_print = verbose, private_data = env, } |
| 1517 | class = Instruction classes ( opcode ) |
| 1518 | opcode = alu/jmp fields ( opcode ) |
| 1519 | mode = BPF BPF_DW 0x18 64-bit ( opcode ) |
| 1520 | dreg = 1u << dest register |
| 1521 | sreg = 1u << source register |
| 1524 | If opcode == 0 Then Return 0 |
| 1526 | If level & BPF_LOG_LEVEL Then |
| 1527 | verbose(env, "regs=%x stack=%llx before ", * reg_mask, * stack_mask) |
| 1529 | print_bpf_insn( & cbs, insn, allow_ptr_leaks) |
| 1532 | If class == BPF_ALU || class == alu mode in double word width Then |
| 1574 | If source register != BPF_REG_FP Then Return 0 |
| 1576 | If ld/ldx fields ( opcode ) != double word (64-bit) Then Return 0 |
| 1583 | spi = (- signed offset - 1) / size of eBPF register in bytes |
| 1584 | If spi >= 64 Then |
| 1589 | stack_mask |= 1ull << spi |
| 1591 | If reg_mask & dreg Then Return -Operation is not supported |
| 1598 | If dest register != BPF_REG_FP Then Return 0 |
| 1600 | If ld/ldx fields ( opcode ) != double word (64-bit) Then Return 0 |
| 1602 | spi = (- signed offset - 1) / size of eBPF register in bytes |
| 1603 | If spi >= 64 Then |
| 1608 | If Not (stack_mask & 1ull << spi ) Then Return 0 |
| 1610 | stack_mask &= ~(1ull << spi) |
| 1613 | Else if class == BPF_JMP || class == jmp mode in word width Then |
| 1614 | If opcode == unction call Then |
| 1615 | If source register == when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative* offset to another bpf function Then Return -Operation is not supported |
| 1618 | reg_mask &= ~1 |
| 1619 | If reg_mask & 0x3f Then |
| 1627 | Else if opcode == unction return Then |
| 1628 | Return -Operation is not supported |
| 1638 | If mode == BPF_IND || mode == BPF_ABS Then Return -Operation is not supported |
| 1642 | Return 0 |
| Name | Describe |
|---|---|
| __mark_chain_precision |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |