Function report |
Source Code:kernel\bpf\verifier.c |
Create Date:2022-07-28 13:02:36 |
| Last Modify:2022-05-19 20:02:10 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:check_btf_func
Proto:static int check_btf_func(struct bpf_verifier_env *env, const union bpf_attr *attr, union bpf_attr __user *uattr)
Type:int
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct bpf_verifier_env * | env | |
| const union bpf_attr * | attr | |
| union bpf_attr __user * | uattr |
| 6669 | krec_size = sizeof(structbpf_func_info) |
| 6671 | struct bpf_func_info_aux * info_aux = NULL |
| 6676 | prev_offset = 0 |
| 6677 | ret = 0 |
| 6680 | If Not nfuncs Then Return 0 |
| 6683 | If nfuncs != subprog_cnt Then |
| 6685 | Return -EINVAL |
| 6689 | If urec_size < The minimum supported BTF func info size || urec_size > MAX_FUNCINFO_REC_SIZE || urec_size % sizeof(u32) Then |
| 6696 | prog = BPF program being verified |
| 6699 | urecord = u64_to_user_ptr(func_info) |
| 6700 | min_size = min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, krec_size, urec_size) |
| 6705 | info_aux = kcalloc - allocate memory for an array. The memory is set to zero.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc). |
| 6711 | If ret Then |
| 6717 | If Write a simple value into user space(min_size, & userspace bpf_func_info size ) Then ret = -EFAULT |
| 6720 | Go to err_free |
| 6723 | If copy_from_user( & krecord[i], urecord, min_size) Then |
| 6729 | If i == 0 Then |
| 6730 | If insn_off Then |
| 6737 | Else if insn_off <= prev_offset Then |
| 6738 | verbose(env, "same or smaller insn offset (%u) than previous func info record (%u)", insn_off, prev_offset) |
| 6742 | Go to err_free |
| 6745 | If insn idx of function entry point != insn_off Then |
| 6748 | Go to err_free |
| 6752 | type = btf_type_by_id(btf, type_id) |
| 6757 | Go to err_free |
| 6759 | prev_offset = insn_off |
| 6764 | func_info_cnt = nfuncs |
| 6765 | func_info_aux = info_aux |
| 6766 | Return 0 |
| 6768 | err_free : |
| 6771 | Return ret |
| Name | Describe |
|---|---|
| check_btf_info |
| 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 |