Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:register_kprobe

Proto:int register_kprobe(struct kprobe *p)

Type:int

Parameter:

TypeParameterName
struct kprobe *p
1606  addr = kprobe_addr(p)
1607  If IS_ERR(addr) Then Return PTR_ERR(addr)
1609  location of the probe point = addr
1611  ret = Return error if the kprobe is being re-registered
1612  If ret Then Return 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  Initialization list head
1620  ret = check_kprobe_address_safe(p, & probed_mod)
1621  If ret Then Return 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  If old_p Then
1629  ret = This is the second or subsequent kprobe at the address - handle* the intricacies
1630  Go to 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  If ret Then Go to out
1642  INIT_HLIST_NODE( & hlist)
1643  adds the specified element to the specified hlist
1646  If Not NOTE: change this value only with kprobe_mutex held && Not Is this kprobe disabled ? Then
1647  ret = Arm a kprobe with text_mutex
1648  If ret Then
1651  Go to 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  If probed_mod Then module_put(probed_mod)
1663  Return ret
Caller
NameDescribe
register_kprobes
fei_write
__register_trace_kprobeInternal register function - just handle k*probes and flags
test_kprobe