Function report |
Source Code:kernel\bpf\btf.c |
Create Date:2022-07-28 13:21:12 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:btf_struct_access
Proto:int btf_struct_access(struct bpf_verifier_log *log, const struct btf_type *t, int off, int size, enum bpf_access_type atype, u32 *next_btf_id)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct bpf_verifier_log * | log | |
| const struct btf_type * | t | |
| int | off | |
| int | size | |
| enum bpf_access_type | atype | |
| u32 * | next_btf_id |
| 3732 | msize = 0 , total_nelems = 0 |
| 3737 | again : |
| 3738 | tname = __btf_name_by_offset(btf_vmlinux, name_off) |
| 3739 | If Not is only a special case of struct:* all its offsetof(member) == 0 Then |
| 3741 | Return -EINVAL |
| 3745 | If btf_member_bitfield_size(t, member) Then Continue |
| 3750 | moff = btf_member_bit_offset(t, member) / 8 |
| 3759 | mtype = btf_type_by_id(btf_vmlinux, type) |
| 3760 | mname = __btf_name_by_offset(btf_vmlinux, name_off) |
| 3774 | If btf_type_is_array(mtype) Then |
| 3821 | msize /= total_nelems |
| 3839 | If btf_type_is_ptr(mtype) Then |
| 3843 | bpf_log(log, "cannot access ptr member %s with moff %u in struct %s with off %u size %u\n", mname, moff, tname, off, size) |
| 3846 | Return -EACCES |
| 3849 | stype = btf_type_by_id(btf_vmlinux, type) |
| 3851 | When btf_type_is_modifier(stype) cycle |
| 3852 | stype = btf_type_by_id(btf_vmlinux, type) |
| 3854 | next_btf_id = type |
| 3855 | Return g points to kernel struct |
| 3866 | bpf_log(log, "access beyond the end of member %s (mend:%u) in struct %s with off %u size %u\n", mname, mtrue_end, tname, off, size) |
| 3869 | Return -EACCES |
| 3872 | Return g doesn't contain a valid pointer |
| 3875 | Return -EINVAL |
| Name | Describe |
|---|---|
| check_ptr_to_btf_access |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |