Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\syscall.c Create Date:2022-07-28 12:52:47
Last Modify:2022-05-19 18:06:12 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:map_get_next_key

Proto:static int map_get_next_key(union bpf_attr *attr)

Type:int

Parameter:

TypeParameterName
union bpf_attr *attr
1119  __user * ukey = u64_to_user_ptr(key)
1120  __user * unext_key = u64_to_user_ptr(next_key)
1121  ufd = anonymous struct used by BPF_MAP_*_ELEM commands
1127  If helper macro to check that unused fields 'union bpf_attr' are zero (BPF_MAP_GET_NEXT_KEY) Then Return -EINVAL
1130  f = fdget(ufd)
1131  map = error is returned, fd is released.* On success caller should complete fd access with matching fdput()
1132  If IS_ERR(map) Then Return PTR_ERR(map)
1134  If Not (map_get_sys_perms(map, f) & Has read method(s) ) Then
1135  err = -EPERM
1136  Go to err_put
1139  If ukey Then
1140  key = __bpf_copy_key(ukey, key_size)
1141  If IS_ERR(key) Then
1142  err = PTR_ERR(key)
1143  Go to err_put
1145  Else
1146  key = NULL
1149  err = -ENOMEM
1150  next_key = Allocation memory
1151  If Not next_key Then Go to free_key
1154  If bpf_map_is_dev_bound(map) Then
1155  err = bpf_map_offload_get_next_key(map, key, next_key)
1156  Go to 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  If err Then Go to free_next_key
1166  err = -EFAULT
1167  If copy_to_user(unext_key, next_key, key_size) != 0 Then Go to 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  Return err