函数逻辑报告 |
Source Code:kernel\bpf\syscall.c |
Create Date:2022-07-27 14:06:22 |
Last Modify:2022-05-19 18:06:12 | Copyright©Brick |
首页 | 函数Tree |
注解内核,赢得工具 | 下载SCCT | English |
函数名称:bpf_prog_load
函数原型:static int bpf_prog_load(union bpf_attr *attr, union bpf_attr __user *uattr)
返回类型:int
参数:
类型 | 参数 | 名称 |
---|---|---|
union bpf_attr * | attr | |
union bpf_attr __user * | uattr |
1704 | type等于 one of enum bpf_prog_type |
1710 | 如果helper macro to check that unused fields 'union bpf_attr' are zero (BPF_PROG_LOAD)则返回:负EINVAL |
1733 | 如果insn_cnt恒等于0或insn_cnt大于如果操作权限检查则yes. 1M insns 否则BPF_MAXINSNS则返回:负E2BIG |
1736 | 如果type不等于BPF_PROG_TYPE_SOCKET_FILTER且type不等于BPF_PROG_TYPE_CGROUP_SKB且非操作权限检查则返回:负EPERM |
1748 | prog等于bpf_prog_alloc(bpf_prog_size(insn_cnt), GFP_USER) |
1752 | For some prog types 等于 For some prog types expected attach type must be known at * load time to verify attach type specific parts of prog * (context accesses, allowed helpers, etc). |
1754 | 如果 0 to attach to vmlinux 则 |
1757 | tgt_prog等于bpf_prog_get( 0 to attach to vmlinux ) |
1758 | 如果是错误则 |
1760 | 转到:free_prog_nouncharge |
1762 | linked_prog等于tgt_prog |
1767 | err等于security_bpf_prog_alloc( Auxiliary fields ) |
1768 | 如果err则转到:free_prog_nouncharge |
1771 | err等于bpf_prog_charge_memlock(prog) |
1772 | 如果err则转到:free_prog_sec |
1775 | Number of filter blocks 等于insn_cnt |
1778 | 如果copy_from_user(insns, u64_to_user_ptr(insns), bpf_prog_insn_size(prog))不等于0则转到:free_prog |
1782 | Original BPF program = NULL |
1783 | Is our filter JIT'ed? 等于0 |
1785 | atomic64_set( & refcnt, 1) |
1786 | Is filter GPL compatible? 等于如果is_gpl则1否则0 |
1788 | 如果bpf_prog_is_dev_bound( Auxiliary fields )则 |
1795 | err等于find_prog_type(type, prog) |
1799 | ns since boottime 等于ktime_get_boottime_ns() |
1800 | err等于dst and src must have at least BPF_OBJ_NAME_LEN number of bytes.* Return 0 on success and < 0 on error. |
1806 | 如果err小于0则转到:free_used_maps |
1810 | 如果err小于0则转到:free_used_maps |
1813 | err等于bpf_prog_alloc_id(prog) |
1814 | 如果err则转到:free_used_maps |
1831 | bpf_prog_kallsyms_add(prog) |
1832 | perf_event_bpf_event(prog, PERF_BPF_EVENT_PROG_LOAD, 0) |
1834 | err等于bpf_prog_new_fd(prog) |
1835 | 如果err小于0则bpf_prog_put(prog) |
1837 | 返回:err |
1839 | free_used_maps : |
1845 | 返回:err |
1846 | free_prog : |
1848 | free_prog_sec : |
1850 | free_prog_nouncharge : |
1852 | 返回:err |
源代码转换工具 开放的插件接口 | X |
---|---|
支持:c/c++/esqlc/java Oracle/Informix/Mysql 插件可实现:逻辑报告 代码生成和批量转换代码 |