函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:kernel\kprobes.c Create Date:2022-07-27 12:38:30
Last Modify:2022-05-22 18:14:58 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:__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.

函数原型:kprobe_opcode_t *__get_insn_slot(struct kprobe_insn_cache *c)

返回类型:kprobe_opcode_t

参数:

类型参数名称
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  如果nused小于slots_per_page(c)则
143 i小于slots_per_page(c)循环
144  如果slot_used[i]恒等于SLOT_CLEAN
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  如果nr_garbagecollect_garbage_slots(c)恒等于0则转到:retry
164  kip等于开辟内存
165  如果非kip则转到:out
173  Page of instruction slots 等于alloc()
174  如果非Page of instruction slots
175  kfree(kip)
176  转到:out
178  初始化链表头
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  添加RCU保护项
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  返回:slot
调用者
名称描述
get_insn_slot
get_optinsn_slot