Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:alled via syscall

Proto:static int map_create(union bpf_attr *attr)

Type:int

Parameter:

TypeParameterName
union bpf_attr *attr
634  numa_node = bpf_map_attr_numa_node(attr)
640  err = helper macro to check that unused fields 'union bpf_attr' are zero (BPF_MAP_CREATE)
641  If err Then Return -EINVAL
644  f_flags = bpf_get_file_flag( BPF_MAP_CREATE related * flags defined above.)
645  If f_flags < 0 Then Return f_flags
648  If numa_node != NUMA_NO_NODE && ( numa_node >= nr_node_ids || Not node_online(numa_node) ) Then Return -EINVAL
654  map = find_and_alloc_map(attr)
655  If IS_ERR(map) Then Return PTR_ERR(map)
658  err = dst and src must have at least BPF_OBJ_NAME_LEN number of bytes.* Return 0 on success and < 0 on error.
659  If err Then Go to free_map
662  atomic64_set( & The 3rd and 4th cacheline with misc members to avoid false sharing * particularly with refcounting., 1)
663  atomic64_set( & usercnt, 1)
664  mutex_init - initialize the mutex*@mutex: the mutex to be initialized* Initialize the mutex to unlocked state.* It is not allowed to initialize an already locked mutex.( & freeze_mutex)
666  If BTF type_id of the key || BTF type_id of the value Then
669  If Not BTF type_id of the value Then
670  err = -EINVAL
671  Go to free_map
674  btf = btf_get_by_fd( fd pointing to a BTF type data )
675  If IS_ERR(btf) Then
676  err = PTR_ERR(btf)
677  Go to free_map
680  err = map_check_btf(map, btf, BTF type_id of the key , BTF type_id of the value )
682  If err Then
683  btf_put(btf)
684  Go to free_map
687  btf = btf
688  btf_key_type_id = BTF type_id of the key
689  btf_value_type_id = BTF type_id of the value
690  Else
691  >=0 valid offset, <0 error = -EINVAL
694  err = security_bpf_map_alloc(map)
695  If err Then Go to free_map
698  err = bpf_map_alloc_id(map)
699  If err Then Go to free_map_sec
702  err = bpf_map_new_fd(map, f_flags)
703  If err < 0 Then
710  bpf_map_put_with_uref(map)
711  Return err
714  Return err
716  free_map_sec :
717  security_bpf_map_free(map)
718  free_map :
719  btf_put(btf)
720  bpf_map_charge_move( & mem, & memory)
721  map_free(map)
722  bpf_map_charge_finish( & mem)
723  Return err