Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\kprobes.c Create Date:2022-07-28 11:34:46
Last Modify:2022-05-22 18:14:58 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:__get_insn_slot() - Find a slot on an executable page for an instruction.* We allocate an executable page if there's no room on existing ones.

Proto:kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c)

Type:kprobe_opcode_t

Parameter:

TypeParameterName
struct kprobe_insn_cache *c
134  kprobe_opcode_t * slot = NULL
137  mutex_lock( & mutex)
138  retry :
139  _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
141  If nused < slots_per_page(c) Then
143  When i < slots_per_page(c) cycle
144  If slot_used[i] == SLOT_CLEAN Then
153  nused = slots_per_page(c)
154  WARN_ON(1)
157  _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()
160  If nr_garbage && collect_garbage_slots(c) == 0 Then Go to retry
164  kip = Allocation memory
165  If Not kip Then Go to out
173  Page of instruction slots = alloc()
174  If Not Page of instruction slots Then
175  kfree(kip)
176  Go to out
178  Initialization list head
179  memset(slot_used, SLOT_CLEAN, slots_per_page(c))
180  slot_used[0] = SLOT_USED
181  nused = 1
182  ngarbage = 0
183  cache = c
184  list_add_rcu - add a new entry to rcu-protected list*@new: new entry to be added*@head: list head to add it after* Insert a new entry after the specified head
185  slot = Page of instruction slots
186  out :
187  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.
188  Return slot
Caller
NameDescribe
get_insn_slot
get_optinsn_slot