Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:map_delete_elem

Proto:static int map_delete_elem(union bpf_attr *attr)

Type:int

Parameter:

TypeParameterName
union bpf_attr *attr
1066  __user * ukey = u64_to_user_ptr(key)
1067  ufd = anonymous struct used by BPF_MAP_*_ELEM commands
1073  If helper macro to check that unused fields 'union bpf_attr' are zero (BPF_MAP_DELETE_ELEM) Then Return -EINVAL
1076  f = fdget(ufd)
1077  map = error is returned, fd is released.* On success caller should complete fd access with matching fdput()
1078  If IS_ERR(map) Then Return PTR_ERR(map)
1080  If Not (map_get_sys_perms(map, f) & Has write method(s) ) Then
1081  err = -EPERM
1082  Go to err_put
1085  key = __bpf_copy_key(ukey, key_size)
1086  If IS_ERR(key) Then
1087  err = PTR_ERR(key)
1088  Go to err_put
1091  If bpf_map_is_dev_bound(map) Then
1092  err = bpf_map_offload_delete_elem(map, key)
1093  Go to out
1094  Else if IS_FD_PROG_ARRAY(map) Then
1095  err = map_delete_elem(map, key)
1096  Go to out
1099  Even if we don't have any preemption, we need preempt disable/enable* to be barriers, so that we don't have things like get_user/put_user* that can cause faults and scheduling migrate into our preempt-protected* region.()
1100  __this_cpu_inc(bpf_prog_active)
1101  _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
1102  err = map_delete_elem(map, key)
1103  _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()
1104  __this_cpu_dec(bpf_prog_active)
1105  preempt_enable()
1106  maybe_wait_bpf_programs(map)
1107  out :
1108  kfree(key)
1109  err_put :
1110  fdput(f)
1111  Return err