Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\kprobes\opt.c Create Date:2022-07-28 08:39:17
Last Modify:2022-05-22 07:44:06 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Decode whole function to ensure any instructions don't jump into target

Proto:static int can_optimize(unsigned long paddr)

Type:int

Parameter:

TypeParameterName
unsigned longpaddr
255  size = 0 , offset = 0
260  If Not kallsyms_lookup_size_offset(paddr, & size, & offset) Then Return 0
267  If paddr >= __entry_text_start && paddr < __entry_text_end || paddr >= __irqentry_text_start && paddr < __irqentry_text_end Then Return 0
274  If size - offset < RELATIVEJUMP_SIZE Then Return 0
278  addr = paddr - offset
279  When addr < paddr - offset + size cycle
281  If Given an address, look for it in the exception tables Then Return 0
287  recovered_insn = Recover the probed instruction at addr for further analysis.* Caller must lock kprobes by kprobe_mutex, or disable preemption* for preventing to release referencing kprobes.* Returns zero if the instruction can not get recovered (or access failed).
288  If Not recovered_insn Then Return 0
290  Init insn for kernel text
291  sn_get_length() - Get the length of instruction*@insn: &struct insn containing instruction* If necessary, first collects the instruction up to and including the* immediates bytes.
293  If bytes[0] == BREAKPOINT_INSTRUCTION Then Return 0
296  kernel address of insn to analyze = addr
297  next_byte = addr + length
299  If insn_is_indirect_jump( & insn) || Check whether insn jumps into specified address range Then Return 0
303  addr += length
306  Return 1
Caller
NameDescribe
arch_prepare_optimized_kprobeCopy replacing target instructions* Target instructions MUST be relocatable (checked inside)* This is called when new aggr(opt)probe is allocated or reused.