Re: [PATCH v3 6/8] x86/module: perpare module loading for ROX allocations of text

Mike Rapoport <[email protected]>
Newsgroups gmane.linux.kernel.cross-arch,gmane.linux.kernel.bpf,gmane.linux.ports.alpha,gmane.linux.ports.arm.kernel,gmane.linux.ports.hexagon,gmane.linux.kernel,gmane.linux.ports.mips,gmane.linux.kernel.mm,gmane.linux.kernel.modules,gmane.linux.ports.parisc,gmane.linux.ports.riscv,gmane.linux.ports.sh.devel,gmane.linux.kernel.arc,gmane.linux.uml.devel,gmane.linux.ports.ppc64.devel,gmane.linux.ports.sparc
Message-ID <[email protected]>
On Mon, Sep 09, 2024 at 11:29:23AM +0200, Peter Zijlstra wrote:
> On Mon, Sep 09, 2024 at 09:47:28AM +0300, Mike Rapoport wrote:
> > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
> > index 8da0e66ca22d..563d9a890ce2 100644
> > --- a/arch/x86/kernel/ftrace.c
> > +++ b/arch/x86/kernel/ftrace.c
> 
> > @@ -654,4 +656,15 @@ void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
> >  }
> >  #endif
> >  
> > +void ftrace_swap_func(void *a, void *b, int n)
> > +{
> > +	unsigned long t;
> > +
> > +	WARN_ON_ONCE(n != sizeof(t));
> > +
> > +	t = *((unsigned long *)a);
> > +	text_poke_copy(a, b, sizeof(t));
> > +	text_poke_copy(b, &t, sizeof(t));
> > +}
> 
> This is insane, just force BUILDTIME_MCOUNT_SORT

The comment in ftrace.c says "... while mcount loc in modules can not be
sorted at build time"
 
I don't know enough about objtool, but I'd presume it's because the sorting
should happen after relocations, no?

-- 
Sincerely yours,
Mike.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.