Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:btf_ctx_access

Proto:bool btf_ctx_access(int off, int size, enum bpf_access_type type, const struct bpf_prog *prog, struct bpf_insn_access_aux *info)

Type:bool

Parameter:

TypeParameterName
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  If off % 8 Then
3646  bpf_log(log, "func '%s' offset %d is not multiple of 8\n", tname, off)
3648  Return false
3650  arg = off / 8
3651  args = t + 1
3653  nr_args = If t Then btf_type_vlen(t) Else 5
3654  If true if attaching to BTF-enabled raw tp Then
3656  args++
3657  nr_args--
3660  If For some prog types == BPF_TRACE_FEXIT && arg == nr_args Then
3662  If Not t Then Return true
3666  t = btf_type_by_id(btf, type)
3667  Else if arg >= nr_args Then
3668  bpf_log(log, "func '%s' doesn't have %d-th argument\n", tname, arg + 1)
3670  Return false
3671  Else
3672  If Not t Then Return true
3675  t = btf_type_by_id(btf, type)
3678  When btf_type_is_modifier(t) cycle
3679  t = btf_type_by_id(btf, type)
3680  If btf_type_is_int(t) Then Return true
3683  If Not btf_type_is_ptr(t) Then
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  Return false
3691  If type == 0 Then Return true
3699  reg_type = g points to kernel struct
3700  btf_id = type
3702  If tgt_prog Then
3703  ret = btf_translate_to_vmlinux(log, btf, t, Type of BPF program )
3704  If ret > 0 Then
3705  btf_id = ret
3706  Return true
3707  Else
3708  Return false
3711  t = btf_type_by_id(btf, type)
3713  When btf_type_is_modifier(t) cycle
3714  t = btf_type_by_id(btf, type)
3715  If Not is only a special case of struct:* all its offsetof(member) == 0 Then
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  Return 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  Return true
Caller
NameDescribe
tracing_prog_is_valid_access