Subject: Re: [PATCH] kprobes: Enable tracing for mololithic kernel images

From: Jarkko Sakkinen <[email-masked]>
Date: Tue, 14 Jun 2022 15:26:59 +0300

@kernel.org>, Masahiro Yamada <[email-masked]>, Jarkko Sakkinen <[email-masked]>, Sami Tolvanen <[email-masked]>, "Naveen N. Rao" <[email-masked]>, Marco Elver <[email-masked]>, Kees Cook <[email-masked]>, Steven Rostedt <[email-masked]>, Nathan Chancellor <[email-masked]>, Mark Brown <[email-masked]>, Borislav Petkov <[email-masked]>, Alexander Egorenkov <[email-masked]>, Thomas Bogendoerfer <[email-masked]>, [email-masked], Nathaniel McCallum <[email-masked]>, Dmitry Torokhov <[email-masked]>, "David S. Miller" <[email-masked]>, "Kirill A. Shutemov" <[email-masked]>, Tobias Huschle <[email-masked]>, "Peter Zijlstra \(Intel\)" <[email-masked]>, "H. Peter Anvin" <[email-masked]>, [email-masked], Tiezhu Yang <[email-masked]>, Miroslav Benes <[email-masked]>, Chen Zhongjin <[email-masked]>, Ard Biesheuvel <[email-masked]>, 
 [email-masked], "Russell King \(Oracle\)" <[email-masked]>, [email-masked], Ingo Molnar <[email-masked]>, Aaron Tomlin <[email-masked]>, Albert Ou <[email-masked]>, Heiko Carstens <[email-masked]>, Liao Chang <[email-masked]>, Paul Walmsley <[email-masked]>, Josh Poimboeuf <[email-masked]>, Thomas Richter <[email-masked]>, [email-masked], Changbin Du <[email-masked]>, Palmer Dabbelt <[email-masked]>, [email-masked], [email-masked]
Errors-To: linuxppc-dev-bounces+linuxppc-dev=[email-masked]
Sender: "Linuxppc-dev" <linuxppc-dev-bounces+linuxppc-dev=[email-masked]>

On Thu, Jun 09, 2022 at 06:44:45AM -0700, Luis Chamberlain wrote:
> On Thu, Jun 09, 2022 at 08:47:38AM +0100, Russell King (Oracle) wrote:
> > On Wed, Jun 08, 2022 at 02:59:27AM +0300, Jarkko Sakkinen wrote:
> > > diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
> > > index 553866751e1a..d2bb954cd54f 100644
> > > --- a/arch/arm/kernel/Makefile
> > > +++ b/arch/arm/kernel/Makefile
> > > @@ -44,6 +44,11 @@ obj-$(CONFIG_CPU_IDLE)		+= cpuidle.o
> > >  obj-$(CONFIG_ISA_DMA_API)	+= dma.o
> > >  obj-$(CONFIG_FIQ)		+= fiq.o fiqasm.o
> > >  obj-$(CONFIG_MODULES)		+= armksyms.o module.o
> > > +ifeq ($(CONFIG_MODULES),y)
> > > +obj-y				+= module_alloc.o
> > > +else
> > > +obj-$(CONFIG_KPROBES)		+= module_alloc.o
> > > +endif
> > 
> > Doesn't:
> > 
> > obj-$(CONFIG_MODULES)		+= module_alloc.o
> > obj-$(CONFIG_KPROBES)		+= module_alloc.o
> 
> That just begs for a new kconfig symbol for the object, and for
> the object then to be built with it.
> 
> The archs which override the default can use ARCH_HAS_VM_ALLOC_EXEC.
> Please note that the respective free is important as well and its
> not clear if we need an another define for the free. Someone has
> to do that work. We want to ensure to noexec the code on free and
> this can vary on each arch.

Let me check if I understand this (not 100% sure).

So if arch define ARCH_HAS_VMALLOC_EXEC, then this would set
config flag CONFIG_VMALLOC_EXEC, which would be used to include
the compilation unit?

BR, Jarkko