On Tue, 23 Nov 2021 12:39:15 +0100 (CET) Miroslav Benes <mbenes@xxxxxxx> wrote: > +++ b/kernel/livepatch/patch.c > @@ -127,15 +127,18 @@ static void notrace klp_ftrace_handler(unsigned long ip, > /* > * Convert a function address into the appropriate ftrace location. > * > - * Usually this is just the address of the function, but on some architectures > - * it's more complicated so allow them to provide a custom behaviour. > + * Usually this is just the address of the function, but there are some > + * exceptions. > + * > + * * PPC - live patch works only with -mprofile-kernel. In this case, > + * the ftrace location is always within the first 16 bytes. > + * * x86_64 with CET/IBT enabled - there is ENDBR instruction at +0 offset. > + * __fentry__ follows it. > */ > -#ifndef klp_get_ftrace_location > -static unsigned long klp_get_ftrace_location(unsigned long faddr) > +static inline unsigned long klp_get_ftrace_location(unsigned long faddr) Why make this the default function? It should only do this for powerpc and x86 *if* CET/IBT is enabled. -- Steve > { > - return faddr; > + return ftrace_location_range(faddr, faddr + 16); > } > -#endif >