Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:btf_struct_check_meta

Proto:static s32 btf_struct_check_meta(struct btf_verifier_env *env, const struct btf_type *t, u32 meta_left)

Type:s32

Parameter:

TypeParameterName
struct btf_verifier_env *env
const struct btf_type *t
u32meta_left
2134  is_union = BTF_INFO_KIND( "info" bits arrangement * bits 0-15: vlen (e.g. # of struct's members) * bits 16-23: unused * bits 24-27: kind (e.g. int, ptr, array...etc) * bits 28-30: unused * bit 31: kind_flag, currently used by * struct, union and fwd) == Union
2137  btf = btf
2138  struct_size = size
2142  meta_needed = btf_type_vlen(t) * size of member
2143  If meta_left < meta_needed Then
2144  btf_verifier_log_basic(env, t, "meta_left:%u meta_needed:%u", meta_left, meta_needed)
2147  Return -EINVAL
2151  If name_off && Not Only C-style identifier is permitted. This can be relaxed if* necessary. Then
2153  btf_verifier_log_type(env, t, "Invalid name")
2154  Return -EINVAL
2157  btf_verifier_log_type(env, t, NULL)
2159  last_offset = 0
2161  If Not btf_name_offset_valid(btf, name_off) Then
2162  btf_verifier_log_member(env, t, member, "Invalid member name_offset:%u", name_off)
2165  Return -EINVAL
2169  If name_off && Not Only C-style identifier is permitted. This can be relaxed if* necessary. Then
2171  btf_verifier_log_member(env, t, member, "Invalid name")
2172  Return -EINVAL
2175  If Not type || Not BTF_TYPE_ID_VALID(type) Then
2176  btf_verifier_log_member(env, t, member, "Invalid type_id")
2178  Return -EINVAL
2181  offset = btf_member_bit_offset(t, member)
2182  If is_union && offset Then
2183  btf_verifier_log_member(env, t, member, "Invalid member bits_offset")
2185  Return -EINVAL
2192  If last_offset > offset Then
2193  btf_verifier_log_member(env, t, member, "Invalid member bits_offset")
2195  Return -EINVAL
2198  If BITS_ROUNDUP_BYTES(offset) > struct_size Then
2199  btf_verifier_log_member(env, t, member, "Member bits_offset exceeds its struct size")
2201  Return -EINVAL
2204  btf_verifier_log_member(env, t, member, NULL)
2205  last_offset = offset
2208  Return meta_needed