函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\btf.c Create Date:2022-07-27 14:38:44
Last Modify:2020-03-12 14:18:49 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:btf_ctx_access

函数原型:bool btf_ctx_access(int off, int size, enum bpf_access_type type, const struct bpf_prog *prog, struct bpf_insn_access_aux *info)

返回类型:bool

参数:

类型参数名称
intoff
intsize
enum bpf_access_typetype
const struct bpf_prog *prog
struct bpf_insn_access_aux *info
3636  t等于 BTF_KIND_FUNC_PROTO for valid attach_btf_id
3637  tgt_prog等于linked_prog
3638  btf等于bpf_prog_get_target_btf(prog)
3639  tname等于 function name for valid attach_btf_id
3640  log等于r verbose logs
3645  如果off取模8则
3646  bpf_log(log, "func '%s' offset %d is not multiple of 8\n", tname, off)
3648  返回:false
3650  arg等于off除8
3651  args等于t加1
3653  nr_args等于如果tbtf_type_vlen(t)否则5
3654  如果 true if attaching to BTF-enabled raw tp
3656  args自加
3657  nr_args自减
3660  如果 For some prog types 恒等于BPF_TRACE_FEXITarg恒等于nr_args
3662  如果非t则返回:true
3666  t等于btf_type_by_id(btf, type)
3667  否则如果arg大于等于nr_args
3668  bpf_log(log, "func '%s' doesn't have %d-th argument\n", tname, arg + 1)
3670  返回:false
3671  否则
3672  如果非t则返回:true
3675  t等于btf_type_by_id(btf, type)
3678 btf_type_is_modifier(t)循环
3679  t等于btf_type_by_id(btf, type)
3680  如果btf_type_is_int(t)则返回:true
3683  如果非btf_type_is_ptr(t)则
3684  bpf_log(log, "func '%s' arg%d '%s' has type %s. Only pointer access is allowed\n", tname, arg, __btf_name_by_offset(btf, name_off), btf_kind_str[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)])
3689  返回:false
3691  如果type恒等于0则返回:true
3699  reg_type等于g points to kernel struct
3700  btf_id等于type
3702  如果tgt_prog
3703  ret等于btf_translate_to_vmlinux(log, btf, t, Type of BPF program )
3704  如果ret大于0则
3705  btf_id等于ret
3706  返回:true
3707  否则
3708  返回:false
3711  t等于btf_type_by_id(btf, type)
3713 btf_type_is_modifier(t)循环
3714  t等于btf_type_by_id(btf, type)
3715  如果非 is only a special case of struct:* all its offsetof(member) == 0
3716  bpf_log(log, "func '%s' arg%d type %s is not a struct\n", tname, arg, btf_kind_str[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)])
3719  返回:false
3721  bpf_log(log, "func '%s' arg%d has btf_id %d type %s '%s'\n", tname, arg, btf_id, btf_kind_str[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)], __btf_name_by_offset(btf, name_off))
3724  返回:true
调用者
名称描述
tracing_prog_is_valid_access