[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250206121328.GN7145@noisy.programming.kicks-ass.net>
Date: Thu, 6 Feb 2025 13:13:28 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Gabriel de Perthuis <g2p.code@...il.com>,
Haiyue Wang <haiyuewa@....com>,
Sami Tolvanen <samitolvanen@...gle.com>,
Mark Rutland <mark.rutland@....com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H . Peter Anvin" <hpa@...or.com>, x86@...nel.org,
linux-trace-kernel@...r.kernel.org,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ftrace: x86: Fix a compile error about
get_kernel_nofault()
On Thu, Feb 06, 2025 at 08:54:49PM +0900, Masami Hiramatsu wrote:
> On Thu, 6 Feb 2025 09:12:25 +0100
> Peter Zijlstra <peterz@...radead.org> wrote:
>
> >
> > > +#ifdef CONFIG_HAVE_FENTRY
> > > +/* Convert fentry address to the symbol address. */
> > > +unsigned long arch_ftrace_get_symaddr(unsigned long fentry_ip)
> > > +{
> > > +#ifdef CONFIG_X86_KERNEL_IBT
> > > + u32 instr;
> > > +
> > > + /* We want to be extra safe in case entry ip is on the page edge,
> > > + * but otherwise we need to avoid get_kernel_nofault()'s overhead.
> > > + */
> > > + if ((fentry_ip & ~PAGE_MASK) < ENDBR_INSN_SIZE) {
> > > + if (get_kernel_nofault(instr, (u32 *)(fentry_ip - ENDBR_INSN_SIZE)))
> > > + return fentry_ip;
> > > + } else {
> > > + instr = *(u32 *)(fentry_ip - ENDBR_INSN_SIZE);
> > > + }
> > > + if (is_endbr(instr))
> > > + fentry_ip -= ENDBR_INSN_SIZE;
> > > +#endif
> > > + return fentry_ip;
> > > +}
> > > +#endif
> >
> > Urgh, that reminds, me. I have a pile of patches cleaning up this mess.
> > Let me go find them.
>
> Thanks for cleaning up! So would it change the location of ENDBR and
> symbol address?
No, it just cleans up this utter trainwreck. I also noticed this is a
second (new) copy of this garbage. Clearly I didn't yell loud enough
last time and people didn't think to vomit when doing the copy/paste :/
Function will look something like:
unsigned long arch_ftrace_get_symaddr(unsigned long fentry_ip)
{
if (is_endbr(fentry_ip - ENDBR_INSN_SIZE))
fentry_op -= ENDBR_INSN_SIZE;
return fentry_ip;
}
Let me finish local build test before I push out.
Powered by blists - more mailing lists