Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:btf_int_check_member

Proto:static int btf_int_check_member(struct btf_verifier_env *env, const struct btf_type *struct_type, const struct btf_member *member, const struct btf_type *member_type)

Type:int

Parameter:

TypeParameterName
struct btf_verifier_env *env
const struct btf_type *struct_type
const struct btf_member *member
const struct btf_type *member_type
1232  int_data = btf_type_int(member_type)
1233  struct_bits_off = If the type info kind_flag is set, the btf_member offset* contains both member bitfield size and bit offset. The* bitfield size is set for bitfield members. If the type* info kind_flag is not set, the offset contains only bit* offset.
1234  struct_size = size
1238  If U32_MAX - struct_bits_off < BTF_INT_OFFSET(int_data) Then
1239  btf_verifier_log_member(env, struct_type, member, "bits_offset exceeds U32_MAX")
1241  Return -EINVAL
1244  struct_bits_off += BTF_INT_OFFSET(int_data)
1245  bytes_offset = BITS_ROUNDDOWN_BYTES(struct_bits_off)
1246  nr_copy_bits = BTF_INT_BITS(int_data) + BITS_PER_BYTE_MASKED(struct_bits_off)
1249  If nr_copy_bits > BTF verification:* To verify BTF data, two passes are needed.* Pass #1* ~~~~~~~* The first pass is to collect all btf_type objects to* an array: "btf->types".* Depending on the C type that a btf_type is describing, Then
1250  btf_verifier_log_member(env, struct_type, member, "nr_copy_bits exceeds 128")
1252  Return -EINVAL
1255  If struct_size < bytes_offset || struct_size - bytes_offset < BITS_ROUNDUP_BYTES(nr_copy_bits) Then
1257  btf_verifier_log_member(env, struct_type, member, "Member exceeds struct_size")
1259  Return -EINVAL
1262  Return 0