Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\hashtab.c Create Date:2022-07-28 13:09:16
Last Modify:2022-05-23 09:15:29 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Called from syscall

Proto:static int htab_map_alloc_check(union bpf_attr *attr)

Type:int

Parameter:

TypeParameterName
union bpf_attr *attr
228  percpu = one of enum bpf_map_type == BPF_MAP_TYPE_PERCPU_HASH || one of enum bpf_map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH
230  lru = one of enum bpf_map_type == BPF_MAP_TYPE_LRU_HASH || one of enum bpf_map_type == BPF_MAP_TYPE_LRU_PERCPU_HASH
237  percpu_lru = BPF_MAP_CREATE related * flags defined above. & Instead of having one common LRU list in the* BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list* which can scale and perform better.* Note, the LRU nodes (including free nodes) cannot be moved* across different LRU lists.
238  prealloc = Not ( BPF_MAP_CREATE related * flags defined above. & lags for BPF_MAP_CREATE command )
239  zero_seed = BPF_MAP_CREATE related * flags defined above. & Zero-initialize hash function seed. This should only be used for testing.
240  numa_node = bpf_map_attr_numa_node(attr)
242  BUILD_BUG_ON - break compile if a condition is true(offsetof(structhtab_elem, htab) != offsetof(structhtab_elem, pprev))
244  BUILD_BUG_ON - break compile if a condition is true(offsetof(structhtab_elem, next) != offsetof(structhtab_elem, pprev))
247  If lru && Not Check operation authority Then Return -EPERM
253  If zero_seed && Not Check operation authority Then Return -EPERM
257  If BPF_MAP_CREATE related * flags defined above. & ~HTAB_CREATE_FLAG_MASK || Not bpf_map_flags_access_ok( BPF_MAP_CREATE related * flags defined above.) Then Return -EINVAL
261  If Not lru && percpu_lru Then Return -EINVAL
264  If lru && Not prealloc Then Return -Operation is not supported
267  If numa_node != NUMA_NO_NODE && (percpu || percpu_lru) Then Return -EINVAL
273  If max number of entries in a map == 0 || size of key in bytes == 0 || size of value in bytes == 0 Then Return -EINVAL
277  If size of key in bytes > BPF program can access up to 512 bytes of stack space. Then Return -E2BIG
283  If size of value in bytes >= Maximum allocatable size - BPF program can access up to 512 bytes of stack space. - sizeof(structhtab_elem) Then Return -E2BIG
292  Return 0
Caller
NameDescribe
fd_htab_map_alloc_check