Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\bpf\trampoline.c Create Date:2022-07-28 13:15:38
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:bpf_trampoline_lookup

Proto:struct bpf_trampoline *bpf_trampoline_lookup(u64 key)

Type:struct bpf_trampoline

Parameter:

TypeParameterName
u64key
24  mutex_lock( & serializes access to trampoline_table )
25  head = trampoline_table[hash_64(key, f_vmlinux has ~22k attachable functions. 1k htab is enough. )]
27  If key == key Then
28  _inc - increment a refcount*@r: the refcount to increment* Similar to atomic_inc(), but will saturate at REFCOUNT_SATURATED and WARN
29  Go to out
32  tr = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc).
33  If Not tr Then Go to out
37  image = bpf_jit_alloc_exec(PAGE_SIZE)
38  If Not image Then
39  kfree(tr)
40  tr = NULL
41  Go to out
44  key = key
45  INIT_HLIST_NODE( & hlist for trampoline_table )
46  hlist_add_head( & hlist for trampoline_table , head)
47  _set - set a refcount's value*@r: the refcount*@n: value to which the refcount will be set
48  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.( & serializes access to fields of this trampoline )
49  When i < BPF_TRAMP_MAX cycle INIT_HLIST_HEAD( & list of BPF programs using this trampoline [i])
52  set_vm_flush_reset_perms(image)
56  set_memory_x((long)image, 1)
57  Executable image of trampoline = image
58  out :
59  mutex_unlock - release the mutex*@lock: the mutex to be released* Unlock a mutex that has been locked by this task previously.* This function must not be used in interrupt context. Unlocking* of a not locked mutex is not allowed.
60  Return tr
Caller
NameDescribe
check_attach_btf_id