Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:alloc_stack_state()

Proto:static int realloc_stack_state(struct bpf_func_state *state, int size, bool copy_old)

Type:int

Parameter:

TypeParameterName
struct bpf_func_state *state
intsize
boolcopy_old
651  old_size = allocated_stack
651  slot = size / 8
651  If size <= old_size || Not size Then
651  If copy_old Then Return 0
651  allocated_stack = slot * 8
651  If Not size && old_size Then
651  kfree(stack)
651  stack = NULL
651  Return 0
651  new_stack = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
651  If Not new_stack Then Return -ENOMEM
651  If copy_old Then
651  If stack Then gcc 内建函数 需要声明
651  __builtin_memset(new_stack + old_size / 8, 0, size of new_stack * (size - old_size) / 8)
651  allocated_stack = slot * 8
651  kfree(stack)
651  stack = new_stack
651  Return 0
Caller
NameDescribe
realloc_func_statedo_check() starts with zero-sized stack in struct bpf_verifier_state to* make it consume minimal amount of memory