函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\verifier.c Create Date:2022-07-27 14:11:59
Last Modify:2022-05-19 20:02:10 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:runcate register to smaller size (in bytes)* must be called with size < BPF_REG_SIZE

函数原型:static void coerce_reg_to_size(struct bpf_reg_state *reg, int size)

返回类型:void

参数:

类型参数名称
struct bpf_reg_state *reg
intsize
2799  For scalar types (SCALAR_VALUE), this represents our knowledge of * the actual value. * For pointer types, this represents the variable part of the offset * from the pointed-to object, and is shared with all bpf_reg_states * with the same id as us.等于Return @a with all but the lowest @size bytes cleared
2802  mask等于1左移size乘8位的值减1
2803  如果 minimum possible (u64)value 按位与mask的反的值恒等于 maximum possible (u64)value 按位与mask的反的值则
2804  minimum possible (u64)value 与等于mask
2805  maximum possible (u64)value 与等于mask
2806  否则
2807  minimum possible (u64)value 等于0
2808  maximum possible (u64)value 等于mask
2810  minimum possible (s64)value 等于 minimum possible (u64)value
2811  maximum possible (s64)value 等于 maximum possible (u64)value
调用者
名称描述
check_mem_accessheck whether memory at (regno + off) is accessible for t = (read | write)* if t==write, value_regno is a register which value is stored into memory* if t==read, value_regno is a register which will receive the value from memory* if t==write &&
adjust_scalar_min_max_valsWARNING: This function does calculations on 64-bit values, but the actual* execution may occur on 32-bit values. Therefore, things like bitshifts* need extra checks in the 32-bit case.
check_alu_opheck validity of 32-bit and 64-bit arithmetic operations
is_branch_takenmpute branch direction of the expression "if (reg opcode val) goto target;"* and return:* 1 - branch will be taken and "goto target" will be executed* 0 - branch will not be taken and fall-through to next insn* -1 - unknown
check_cond_jmp_op