函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:map_get_next_key

函数原型:static int map_get_next_key(union bpf_attr *attr)

返回类型:int

参数:

类型参数名称
union bpf_attr *attr
1119  __userukey等于u64_to_user_ptr(key)
1120  __userunext_key等于u64_to_user_ptr(next_key)
1121  ufd等于 anonymous struct used by BPF_MAP_*_ELEM commands
1127  如果helper macro to check that unused fields 'union bpf_attr' are zero (BPF_MAP_GET_NEXT_KEY)则返回:负EINVAL
1130  f等于fdget(ufd)
1131  map等于 error is returned, fd is released.* On success caller should complete fd access with matching fdput()
1132  如果是错误则返回:错误
1134  如果非map_get_sys_perms(map, f)按位与Has read method(s) 的值则
1135  err等于负EPERM
1136  转到:err_put
1139  如果ukey
1140  key等于__bpf_copy_key(ukey, key_size)
1141  如果是错误
1142  err等于错误
1143  转到:err_put
1145  否则
1146  key = NULL
1149  err等于负ENOMEM
1150  next_key等于开辟内存
1151  如果非next_key则转到:free_key
1154  如果bpf_map_is_dev_bound(map)则
1155  err等于bpf_map_offload_get_next_key(map, key, next_key)
1156  转到:out
1159  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
1160  err等于map_get_next_key(map, key, next_key)
1161  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
1162  out :
1163  如果err则转到:free_next_key
1166  err等于负EFAULT
1167  如果copy_to_user(unext_key, next_key, key_size)不等于0则转到:free_next_key
1170  err等于0
1172  free_next_key :
1173  kfree(next_key)
1174  free_key :
1175  kfree(key)
1176  err_put :
1177  fdput(f)
1178  返回:err