函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:register_kprobe

函数原型:int register_kprobe(struct kprobe *p)

返回类型:int

参数:

类型参数名称
struct kprobe *p
1606  addr等于kprobe_addr(p)
1607  如果是错误则返回:错误
1609  location of the probe point 等于addr
1611  ret等于Return error if the kprobe is being re-registered
1612  如果ret则返回:ret
1616  * Indicates various status flags. * Protected by kprobe_mutex after this kprobe is registered.与等于probe is temporarily disabled
1617  count the number of times this probe was temporarily disarmed 等于0
1618  初始化链表头
1620  ret等于check_kprobe_address_safe(p, & probed_mod)
1621  如果ret则返回:ret
1624  mutex_lock( & This protects kprobe_table and optimizing_list )
1626  old_p等于This routine is called either:* - under the kprobe_mutex - during kprobe_[un]register()* OR* - with preemption disabled - from arch/xxx/kernel/kprobes.c
1627  如果old_p
1629  ret等于This is the second or subsequent kprobe at the address - handle* the intricacies
1630  转到:out
1633  cpus_read_lock()
1635  mutex_lock( & mutex protecting text section modification (dynamic code patching).* some users need to sleep (allocating memory...) while they hold this lock.* Note: Also protects SMP-alternatives modification on x86.)
1636  ret等于prepare_kprobe(p)
1637  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.
1638  cpus_read_unlock()
1639  如果ret则转到:out
1642  INIT_HLIST_NODE( & hlist)
1643  添加哈希记录
1646  如果非NOTE: change this value only with kprobe_mutex held 且非Is this kprobe disabled ?
1647  ret等于Arm a kprobe with text_mutex
1648  如果ret
1651  转到:out
1656  Prepare an optimized_kprobe and optimize it* NOTE: p must be a normal registered kprobe
1657  out :
1658  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.
1660  如果probed_modmodule_put(probed_mod)
1663  返回:ret
调用者
名称描述
register_kprobes
fei_write
__register_trace_kprobeInternal register function - just handle k*probes and flags
test_kprobe