Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\kprobes\core.c Create Date:2022-07-28 08:38:45
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Called from kretprobe_trampoline

Proto:__used __visible void *trampoline_handler(struct pt_regs *regs)

Type:void

Parameter:

TypeParameterName
struct pt_regs *regs
763  struct kretprobe_instance * ri = NULL
766  orig_ret_address = 0
767  unsigned long trampoline_address = (unsigned long) & kretprobe_trampoline
768  kprobe_opcode_t * correct_ret_addr = NULL
770  bool skipped = false
772  Even if we don't have any preemption, we need preempt disable/enable* to be barriers, so that we don't have things like get_user/put_user* that can cause faults and scheduling migrate into our preempt-protected* region.()
779  kcb = get_kprobe_ctlblk()
780  __this_cpu_write(current_kprobe, & kretprobe_kprobe)
781  kprobe_status = kprobe_status settings
783  INIT_HLIST_HEAD( & empty_rp)
784  kretprobe_hash_lock(current process, & head, & flags)
786  cs = Segment selector values corresponding to the above entries:
788  cs |= get_kernel_rpl()
789  gs = 0
792  frame_pointer = sp
793  ip = trampoline_address
794  orig_ax = ~0UL
810  If task != current process Then Continue
821  If fp != frame_pointer Then
822  If Not skipped Then pr_warn("kretprobe is stacked incorrectly. Trying to fixup.\n")
824  skipped = true
825  Continue
828  orig_ret_address = ret_addr
829  If skipped Then pr_warn("%ps must be blacklisted because of incorrect kretprobe order\n", addr)
833  If orig_ret_address != trampoline_address Then Break
842  kretprobe_assert(ri, orig_ret_address, trampoline_address)
844  correct_ret_addr = ret_addr
846  If task != current process Then Continue
849  If fp != frame_pointer Then Continue
852  orig_ret_address = ret_addr
853  If rp && handler Then
854  __this_cpu_write(current_kprobe, & kp)
855  ret_addr = correct_ret_addr
856  handler(ri, regs)
857  __this_cpu_write(current_kprobe, & kretprobe_kprobe)
860  recycle_rp_inst(ri, & empty_rp)
862  If orig_ret_address != trampoline_address Then Break
871  kretprobe_hash_unlock(current process, & flags)
873  __this_cpu_write(current_kprobe, NULL)
874  preempt_enable()
877  hlist_del( & hlist)
878  free previously allocated memory
880  Return orig_ret_address