Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\verifier.c Create Date:2022-07-28 13:04:33
Last Modify:2022-05-19 20:02:10 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:opt_subreg_zext_lo32_rnd_hi32

Proto:static int opt_subreg_zext_lo32_rnd_hi32(struct bpf_verifier_env *env, const union bpf_attr *attr)

Type:int

Parameter:

TypeParameterName
struct bpf_verifier_env *env
const union bpf_attr *attr
8666  struct bpf_insn * patch, zext_patch[2], rnd_hi32_patch[4]
8667  aux = array of per-insn state
8668  delta = 0 , len = Number of filter blocks
8669  insns = insnsi
8673  rnd_hi32 = prog_flags & BPF_F_TEST_RND_HI32 is used in BPF_PROG_LOAD command for testing purpose.* Verifier does sub-register def/use analysis and identifies instructions whose* def only matters for low 32-bit, high 32-bit is never referenced later
8674  zext_patch[1] = Special form of mov32, used for doing explicit zero extension on dst. (0)
8675  rnd_hi32_patch[1] = ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 (mov reg to reg , Kernel hidden auxiliary/helper register. , 0)
8676  rnd_hi32_patch[2] = ALU ops on immediates, bpf_add|sub|...: dst_reg += imm32 (BPF_LSH, Kernel hidden auxiliary/helper register. , 32)
8677  rnd_hi32_patch[3] = ALU ops on registers, bpf_add|sub|...: dst_reg += src_reg (BPF_OR, 0, Kernel hidden auxiliary/helper register. )
8678  When i < len cycle
8679  adj_idx = i + delta
8682  insn = insns[adj_idx]
8687  If Not rnd_hi32 Then Continue
8690  code = opcode
8700  If class == BPF_LD && BPF BPF_DW 0x18 64-bit (code) == BPF_IMM Then i++
8703  Continue
8711  imm_rnd = get_random_int()
8712  rnd_hi32_patch[0] = insn
8716  patch_len = 4
8717  Go to apply_patch_buffer
8720  If Not Return TRUE if the JIT backend wants verifier to enable sub-register usage* analysis code and wants explicit zero extension inserted by verifier.* Otherwise, return FALSE. Then Continue
8723  zext_patch[0] = insn
8724  dest register = dest register
8725  source register = dest register
8726  patch = zext_patch
8727  patch_len = 2
8728  apply_patch_buffer :
8729  new_prog = bpf_patch_insn_data(env, adj_idx, patch, patch_len)
8730  If Not new_prog Then Return -ENOMEM
8732  BPF program being verified = new_prog
8733  insns = insnsi
8734  aux = array of per-insn state
8735  delta += patch_len - 1
8738  Return 0
Caller
NameDescribe
bpf_check