[PATCH] powerpc64/bpf: support direct_call on livepatch function

Naveen N Rao naveen at kernel.org
Thu Oct 9 22:27:53 AEDT 2025


On Thu, Oct 09, 2025 at 11:19:45AM +0530, Hari Bathini wrote:
> 
> 
> On 08/10/25 1:43 pm, Naveen N Rao wrote:
> > On Mon, Oct 06, 2025 at 06:50:20PM +0530, Hari Bathini wrote:
> > > 
> > > 
> > > On 06/10/25 1:22 pm, Naveen N Rao wrote:
> > > > On Fri, Oct 03, 2025 at 12:57:54AM +0530, Hari Bathini wrote:
> > > > > Today, livepatch takes precedence over direct_call. Instead, save the
> > > > > state and make direct_call before handling livepatch.
> > > > 
> > > > If we call into the BPF trampoline first and if we have
> > > > BPF_TRAMP_F_CALL_ORIG set, does this result in the BPF trampoline
> > > > calling the new copy of the live-patched function or the old one?
> > > 
> > > Naveen, calls the new copy of the live-patched function..
> > 
> > Hmm... I'm probably missing something.
> > 
> > With ftrace OOL stubs, what I recall is that BPF trampoline derives the
> > original function address from the OOL stub (which would be associated
> > with the original function, not the livepatch one).
> 
> Trampoline derives the address from LR.

Does it? I'm referring to BPF_TRAMP_F_CALL_ORIG handling in 
__arch_prepare_bpf_trampoline(). LR at BPF trampoline entry points at 
the ftrace OOL stub. We recover the "real LR" pointing to the function 
being traced from there so that we can call into it from within the BPF 
trampoline.

- Naveen



More information about the Linuxppc-dev mailing list