Message ID | 20170516034913.21163-3-bsingharora@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
On 2017/05/16 01:49PM, Balbir Singh wrote: > arch_arm/disarm_probe use direct assignment for copying > instructions, replace them with patch_instruction Thanks for doing this! We will also have to convert optprobes and ftrace to use patch_instruction, but that can be done once the basic infrastructure is in. Regards, Naveen
On Tue, 2017-05-16 at 19:05 +0530, Naveen N. Rao wrote: > On 2017/05/16 01:49PM, Balbir Singh wrote: > > arch_arm/disarm_probe use direct assignment for copying > > instructions, replace them with patch_instruction > > Thanks for doing this! > > We will also have to convert optprobes and ftrace to use > patch_instruction, but that can be done once the basic infrastructure is > in. > I think these patches can go in without even patch 1. I looked quickly at optprobes and ftrace and thought they were already using patch_instruction (ftrace_modify_code() and arch_optimize_kprobes()), are there other paths I missed? Balbir Singh
On 2017/05/17 11:40AM, Balbir Singh wrote: > On Tue, 2017-05-16 at 19:05 +0530, Naveen N. Rao wrote: > > On 2017/05/16 01:49PM, Balbir Singh wrote: > > > arch_arm/disarm_probe use direct assignment for copying > > > instructions, replace them with patch_instruction > > > > Thanks for doing this! > > > > We will also have to convert optprobes and ftrace to use > > patch_instruction, but that can be done once the basic infrastructure is > > in. > > > > I think these patches can go in without even patch 1. I looked quickly at > optprobes and ftrace and thought they were already using patch_instruction > (ftrace_modify_code() and arch_optimize_kprobes()), are there other paths > I missed? [Sorry for the delay...] Yes, all the patch_*_insns() functions need to be converted since the area they patch comes from .text. There is also a memcpy() where we copy the instruction template in, so perhaps a patch_instructions() helper may be useful too. - Naveen
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 160ae0f..5e1fa86 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c @@ -158,7 +158,7 @@ NOKPROBE_SYMBOL(arch_prepare_kprobe); void arch_arm_kprobe(struct kprobe *p) { - *p->addr = BREAKPOINT_INSTRUCTION; + patch_instruction(p->addr, BREAKPOINT_INSTRUCTION); flush_icache_range((unsigned long) p->addr, (unsigned long) p->addr + sizeof(kprobe_opcode_t)); } @@ -166,7 +166,7 @@ NOKPROBE_SYMBOL(arch_arm_kprobe); void arch_disarm_kprobe(struct kprobe *p) { - *p->addr = p->opcode; + patch_instruction(p->addr, BREAKPOINT_INSTRUCTION); flush_icache_range((unsigned long) p->addr, (unsigned long) p->addr + sizeof(kprobe_opcode_t)); }
arch_arm/disarm_probe use direct assignment for copying instructions, replace them with patch_instruction Signed-off-by: Balbir Singh <bsingharora@gmail.com> --- arch/powerpc/kernel/kprobes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)