函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\kprobes\opt.c Create Date:2022-07-27 09:38:35
Last Modify:2022-05-22 07:44:06 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:Copy replacing target instructions* Target instructions MUST be relocatable (checked inside)* This is called when new aggr(opt)probe is allocated or reused.

函数原型:int arch_prepare_optimized_kprobe(struct optimized_kprobe *op, struct kprobe *__unused)

返回类型:int

参数:

类型参数名称
struct optimized_kprobe *op
struct kprobe *__unused
356  buf等于NULL
360  如果非Decode whole function to ensure any instructions don't jump into target 则返回:负EILSEQ
363  buf等于分配内存并置零
364  如果非buf则返回:负ENOMEM
367  detour code buffer 等于slot等于get_optinsn_slot()
368  如果非slot
369  ret等于负ENOMEM
370  转到:out
377  rel等于slot location of the probe point RELATIVEJUMP_SIZE
378  如果abs - return absolute value of an argument*@x: the value. If it is unsigned type, it is converted to signed type first.* char is treated as if it was signed (regardless of whether it really is)* but the macro's return type is preserved as char.(rel)大于0x7fffffff则
379  ret等于负ERANGE
380  转到:err
384  memcpy(buf, ptinsn template addresses , TMPL_END_IDX)
387  ret等于copy_optimized_instructions(buf + TMPL_END_IDX, location of the probe point , slot + TMPL_END_IDX)
389  如果ret小于0则转到:err
391  the size of instructions copied to detour code buffer 等于ret
392  len等于TMPL_END_IDX the size of instructions copied to detour code buffer
395  Insert a move instruction which sets a pointer to eax/rdi (1st arg).
398  Insert a call instruction at address 'from', which calls address 'to'.
402  Insert a jump instruction at address 'from', which jumps to address 'to'.
404  len加等于RELATIVEJUMP_SIZE
407  xt_poke - Update instructions on a live kernel*@addr: address to modify*@opcode: source of the copy*@len: length to copy* Only atomic text poke/set should be allowed when not doing early patching
408  ret等于0
409  out :
410  释放内存
411  返回:ret
413  err :
414  Free optimized instruction slot
415  转到:out
调用者
名称描述
__prepare_optimized_kprobe