ARM架构kprobe应用及实现分析(11 原理)
来源:互联网 发布:淘宝多久不能申请售后 编辑:程序博客网 时间:2024/05/21 11:35
1 拷贝探测的code , 插入特殊指令(ARM是插入未定义指令)
2 CPU运行到未定义指令,会产生trap, 进入ISR,并保存当前寄出去的状态
通过LINUX的通知机制,会执行“pre_handler”(前提是你已经注册过了)
3 进入单步模式,运行你备份出来的代码
(此代码运行的是拷贝出来的,防止别的CPU也恰巧运行到此位置)
4 单步模式后,运行“post_handler”,恢复正常模式,接着运行下面的指令。
参考: kprobes.txt
How Does a Kprobe Work?
When a kprobe is registered, Kprobes makes a copy of the probed
instruction and replaces the first byte(s) of the probed instruction
with a breakpoint instruction (e.g., int3 on i386 and x86_64).
When a CPU hits the breakpoint instruction, a trap occurs, the CPU's
registers are saved, and control passes to Kprobes via the
notifier_call_chain mechanism. Kprobes executes the "pre_handler"
associated with the kprobe, passing the handler the addresses of the
kprobe struct and the saved registers.
Next, Kprobes single-steps its copy of the probed instruction.
(It would be simpler to single-step the actual instruction in place,
but then Kprobes would have to temporarily remove the breakpoint
instruction. This would open a small time window when another CPU
could sail right past the probepoint.)
After the instruction is single-stepped, Kprobes executes the
"post_handler," if any, that is associated with the kprobe.
Execution then continues with the instruction following the probepoint.
- ARM架构kprobe应用及实现分析(11 原理)
- ARM架构kprobe应用及实现分析(8.0 register_kprobe实现)
- ARM架构kprobe应用及实现分析(1.0 简单示例)
- ARM架构kprobe应用及实现分析(10 trap中断注册及回调)
- ARM架构kprobe应用及实现分析(2.0 register_kprobe error 38)
- ARM架构kprobe应用及实现分析(3.0 被探测函数说明)
- ARM架构kprobe应用及实现分析(5.0 打印寄存器的值)
- ARM架构kprobe应用及实现分析(6.0 导出堆栈的值)
- ARM架构kprobe应用及实现分析(7.0 自动显示参数的值)
- ARM架构kprobe应用及实现分析(9.0 arch_prepare_kprobe平台相关注册)
- ARM虚拟地址原理分析及实现
- Hbase的应用场景、原理及架构分析
- Hbase的应用场景、原理及架构分析
- kprobe工作原理
- RemoteViews原理分析及应用
- LocalBroadcastManager原理分析及应用
- linux内核kprobe分析
- HBase架构设计及原理分析
- List和数组的转换方法
- Deep Learning 资料汇总
- android系统移植之文件系统分析
- 动态规划之 最大k乘积
- 考研(2)
- ARM架构kprobe应用及实现分析(11 原理)
- ActiveMQ 入门
- C语言中程序与数据的存储位置
- CSRGXTU SEO
- 解析AFNetWorking 网络框架(一)
- 用JSP创建一个表格模板 .
- C#:Attribute类
- android系统移植之问题汇总
- java中定时任务的实现