[PATCH v1 2/8] powerpc/kprobes: Move kprobes over to patch_instruction

Christophe LEROY christophe.leroy at c-s.fr
Mon May 29 18:50:34 AEST 2017



Le 25/05/2017 à 05:36, Balbir Singh a écrit :
> arch_arm/disarm_probe use direct assignment for copying
> instructions, replace them with patch_instruction
> 
> Signed-off-by: Balbir Singh <bsingharora at gmail.com>
> ---
>   arch/powerpc/kernel/kprobes.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> 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);

Shouldn't it be the following instead ?

patch_instruction(p->addr, p->opcode);

Christophe


>   	flush_icache_range((unsigned long) p->addr,
>   			   (unsigned long) p->addr + sizeof(kprobe_opcode_t));
>   }
> 


More information about the Linuxppc-dev mailing list