函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\syscall.c Create Date:2022-07-27 14:07:34
Last Modify:2022-05-19 18:06:12 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:bpf_prog_get_info_by_fd

函数原型:static int bpf_prog_get_info_by_fd(struct bpf_prog *prog, const union bpf_attr *attr, union bpf_attr __user *uattr)

返回类型:int

参数:

类型参数名称
struct bpf_prog *prog
const union bpf_attr *attr
union bpf_attr __user *uattr
2479  __useruinfo等于u64_to_user_ptr(info)
2480  struct bpf_prog_info info = {}
2481  info_len等于info_len
2483  __useruinsns
2487  err等于If we're handed a bigger struct than we know of, ensure all the unknown bits* are 0 - i.e. new user-space does not rely on any kernel feature extensions* we don't know about yet.* There is a ToCToU between this function call and the following
2488  如果err则返回:err
2490  info_len等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, info的长度, info_len)
2492  如果copy_from_user( & info, uinfo, info_len)则返回:负EFAULT
2495  type等于 Type of BPF program
2496  id等于id
2497  ns since boottime 等于 ns since boottime
2498  created_by_uid等于m_kuid_munged - Create a uid from a kuid user-namespace pair.*@targ: The user namespace we want a uid in.*@kuid: The kernel internal uid to start with.* Map @kuid into the user-namespace specified by @targ and* return the resulting uid.
2500  gpl_compatible等于 Is filter GPL compatible?
2502  内存复制(tag, tag, tag的长度)
2503  内存复制(name, name, name的长度)
2505  ulen等于nr_map_ids
2506  nr_map_ids等于used_map_cnt
2507  ulen等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, nr_map_ids, ulen)
2508  如果ulen
2509  __useruser_map_ids等于u64_to_user_ptr(map_ids)
2512 i小于ulen循环如果put_user - Write a simple value into user space(id, & user_map_ids[i])则
2515  返回:负EFAULT
2518  err等于set_info_rec_size( & info)
2519  如果err则返回:err
2522  bpf_prog_get_stats(prog, & stats)
2523  run_time_ns等于nsecs
2524  run_cnt等于cnt
2526  如果非操作权限检查
2527  jited_prog_len等于0
2528  xlated_prog_len等于0
2529  nr_jited_ksyms等于0
2530  nr_jited_func_lens等于0
2531  nr_func_info等于0
2532  nr_line_info等于0
2533  nr_jited_line_info等于0
2534  转到:done
2537  ulen等于xlated_prog_len
2538  xlated_prog_len等于bpf_prog_insn_size(prog)
2539  如果xlated_prog_lenulen
2543  如果 Was blinded 且非bpf_dump_raw_ok()则
2544  xlated_prog_insns等于0
2545  转到:done
2547  insns_sanitized等于bpf_insn_prepare_dump(prog)
2548  如果非insns_sanitized则返回:负ENOMEM
2550  uinsns等于u64_to_user_ptr(xlated_prog_insns)
2551  ulen等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, xlated_prog_len, ulen)
2552  fault等于copy_to_user(uinsns, insns_sanitized, ulen)
2553  kfree(insns_sanitized)
2554  如果fault则返回:负EFAULT
2558  如果bpf_prog_is_dev_bound( Auxiliary fields )则
2559  err等于bpf_prog_offload_info_fill( & info, prog)
2560  如果err则返回:err
2562  转到:done
2569  ulen等于jited_prog_len
2570  如果 used by non-func prog as the number of func progs
2573  jited_prog_len等于0
2574 i小于 used by non-func prog as the number of func progs 循环jited_prog_len加等于 Size of jited insns in bytes
2576  否则
2577  jited_prog_len等于 Size of jited insns in bytes
2580  如果jited_prog_lenulen
2581  如果bpf_dump_raw_ok()则
2604  否则
2605  如果copy_to_user(uinsns, bpf_func, ulen)则返回:负EFAULT
2608  否则
2609  jited_prog_insns等于0
2613  ulen等于nr_jited_ksyms
2614  nr_jited_ksyms等于如果 used by non-func prog as the number of func progs 否则1
2615  如果ulen
2616  如果bpf_dump_raw_ok()则
2618  __useruser_ksyms
2634  否则
2639  否则
2640  jited_ksyms等于0
2644  ulen等于nr_jited_func_lens
2645  nr_jited_func_lens等于如果 used by non-func prog as the number of func progs 否则1
2646  如果ulen
2647  如果bpf_dump_raw_ok()则
2648  __useruser_lens
2661  否则
2666  否则
2667  jited_func_lens等于0
2671  如果btfbtf_id等于btf_id(btf)
2674  ulen等于nr_func_info
2675  nr_func_info等于func_info_cnt
2676  如果nr_func_infoulen
2677  __useruser_finfo
2679  user_finfo等于u64_to_user_ptr(func_info)
2680  ulen等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, nr_func_info, ulen)
2681  如果copy_to_user(user_finfo, func_info, func_info_rec_size * ulen)则返回:负EFAULT
2686  ulen等于nr_line_info
2687  nr_line_info等于nr_linfo
2688  如果nr_line_infoulen
2689  __useruser_linfo
2691  user_linfo等于u64_to_user_ptr(line_info)
2692  ulen等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, nr_line_info, ulen)
2693  如果copy_to_user(user_linfo, bpf_line_info loaded from userspace. linfo->insn_off * has the xlated insn offset. * Both the main and sub prog share the same linfo. * The subprog can access its first linfo by * using the linfo_idx., line_info_rec_size * ulen)则返回:负EFAULT
2698  ulen等于nr_jited_line_info
2699  如果 jited_linfo is the jited addr of the linfo. It has a * one to one mapping to linfo: * jited_linfo[i] is the jited addr for the linfo[i]->insn_off. * Both the main and sub prog share the same jited_linfo. * The subprog can access its first jited_linfo by *nr_jited_line_info等于nr_linfo
2701  否则nr_jited_line_info等于0
2703  如果nr_jited_line_infoulen
2704  如果bpf_dump_raw_ok()则
2705  __useruser_linfo
2710 i小于ulen循环
2715  否则
2716  jited_line_info等于0
2720  ulen等于nr_prog_tags
2721  nr_prog_tags等于如果 used by non-func prog as the number of func progs 否则1
2722  如果ulen
2723  __u8 __user( * user_prog_tags)[8]
2726  user_prog_tags等于u64_to_user_ptr(prog_tags)
2727  ulen等于min_t - return minimum of two values, using the specified type*@type: data type to use*@x: first value*@y: second value(u32, nr_prog_tags, ulen)
2729 i小于ulen循环
2730  如果copy_to_user(user_prog_tags[i], tag, BPF_TAG_SIZE)则返回:负EFAULT
2735  否则
2736  如果copy_to_user(user_prog_tags[0], tag, BPF_TAG_SIZE)则返回:负EFAULT
2742  done :
2743  如果copy_to_user(uinfo, & info, info_len)或put_user - Write a simple value into user space(info_len, & info_len)则返回:负EFAULT
2747  返回:0
调用者
名称描述
bpf_obj_get_info_by_fd