Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\btf.c Create Date:2022-07-28 13:20:32
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:btf_parse

Proto:static struct btf *btf_parse(void __user *btf_data, u32 btf_data_size, u32 log_level, char __user *log_ubuf, u32 log_size)

Type:struct btf

Parameter:

TypeParameterName
void __user *btf_data
u32btf_data_size
u32log_level
char __user *log_ubuf
u32log_size
3364  struct btf_verifier_env * env = NULL
3366  struct btf * btf = NULL
3370  If btf_data_size > 16MB for 64k structs and each has 16 members and* a few MB spaces for the string section.* The hard limit is S32_MAX. Then Return ERR_PTR( - E2BIG)
3373  env = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
3374  If Not env Then Return ERR_PTR( - ENOMEM)
3377  log = log
3378  If log_level || log_ubuf || log_size Then
3382  level = log_level
3383  ubuf = log_ubuf
3384  len_total = log_size
3387  If len_total < 128 || len_total > UINT_MAX >> 8 || Not level || Not ubuf Then
3389  err = -EINVAL
3390  Go to errout
3394  btf = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
3395  If Not btf Then
3396  err = -ENOMEM
3397  Go to errout
3399  btf = btf
3401  data = kvmalloc(btf_data_size, GFP_KERNEL | DOC: Action modifiers* Action modifiers* ~~~~~~~~~~~~~~~~* %__GFP_NOWARN suppresses allocation failure reports.* %__GFP_COMP address compound page metadata.* %__GFP_ZERO returns a zeroed page on success.)
3402  If Not data Then
3403  err = -ENOMEM
3404  Go to errout
3407  data = data
3408  data_size = btf_data_size
3410  If copy_from_user(data, btf_data, btf_data_size) Then
3411  err = -EFAULT
3412  Go to errout
3415  err = btf_parse_hdr(env)
3416  If err Then Go to errout
3419  nohdr_data = data + hdr_len
3421  err = btf_parse_str_sec(env)
3422  If err Then Go to errout
3425  err = btf_parse_type_sec(env)
3426  If err Then Go to errout
3429  If level && bpf_verifier_log_full(log) Then
3430  err = -ENOSPC
3431  Go to errout
3434  btf_verifier_env_free(env)
3435  _set - set a refcount's value*@r: the refcount*@n: value to which the refcount will be set
3436  Return btf
3438  errout :
3439  btf_verifier_env_free(env)
3440  If btf Then btf_free(btf)
3442  Return ERR_PTR(err)
Caller
NameDescribe
btf_new_fd