[PATCH 4/5] powerpc/kprobes: Setup consistent pt_regs across kprobes, optprobes and KPROBES_ON_FTRACE

Naveen N. Rao naveen.n.rao at linux.vnet.ibm.com
Tue Nov 8 21:52:10 AEDT 2022


Nicholas Piggin wrote:
> On Fri Oct 21, 2022 at 3:29 AM AEST, Naveen N. Rao wrote:
>> Ensure a more consistent pt_regs across kprobes, optprobes and
>> KPROBES_ON_FTRACE:
>> - Drop setting trap to 0x700 under optprobes. This is not accurate and
>>   is unnecessary. Instead, zero it out for both optprobes and
>>   KPROBES_ON_FTRACE.
> 
> Okay I think.
> 
>> - Save irq soft mask in the ftrace handler, similar to what we do in
>>   optprobes and trap-based kprobes.
> 
> This advertises the irqs status of regs correctly, whereas previously
> it was uninitialised.
> 
>> - Drop setting orig_gpr3 and result to zero in optprobes. These are not
>>   relevant under kprobes and should not be used by the handlers.
> 
> This is for CFAR, which we can't get anyway because we just branched
> here. I would rather zero it explicitly though.

Is there a strong reason to zero those out?

The reason I dropped zero'ing of orig_gpr3 and result is to make 
optprobes consistent with KPROBES_ON_FTRACE. If we want to retain 
zero'ing orig_gpr3/result for optprobes, I think we should then go ahead 
and zero those out in ftrace_regs_caller too.

Thanks,
Naveen



More information about the Linuxppc-dev mailing list