[PATCH 14/18] powerpc/kprobes: Support kprobes on prefixed instructions

Michael Ellerman mpe at ellerman.id.au
Thu Jan 16 17:09:32 AEDT 2020


Balamuruhan S <bala24 at linux.ibm.com> writes:
> On Tue, Nov 26, 2019 at 04:21:37PM +1100, Jordan Niethe wrote:
...
>> diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
>> index 7303fe3856cc..aa15b3480385 100644
>> --- a/arch/powerpc/kernel/kprobes.c
>> +++ b/arch/powerpc/kernel/kprobes.c
>> @@ -104,17 +104,30 @@ kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset)
>>  
>>  int arch_prepare_kprobe(struct kprobe *p)
>>  {
>> +	int len;
>>  	int ret = 0;
>> +	struct kprobe *prev;
>>  	kprobe_opcode_t insn = *p->addr;
>> +	kprobe_opcode_t prfx = *(p->addr - 1);
>>  
>> +	preempt_disable();
>>  	if ((unsigned long)p->addr & 0x03) {
>>  		printk("Attempt to register kprobe at an unaligned address\n");
>>  		ret = -EINVAL;
>>  	} else if (IS_MTMSRD(insn) || IS_RFID(insn) || IS_RFI(insn)) {
>>  		printk("Cannot register a kprobe on rfi/rfid or mtmsr[d]\n");
>>  		ret = -EINVAL;
>> +	} else if (IS_PREFIX(prfx)) {
>> +		printk("Cannot register a kprobe on the second word of prefixed instruction\n");
>
> Let's have line with in 80 columns length.

We don't split printk strings across lines. So this is fine.

cheers


More information about the Linuxppc-dev mailing list