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

From
Jarkko Sakkinen <jarkko@kernel.org>
Date
2022-06-15 21:26:19
Also in
linux-mips, linux-modules, linux-riscv, linux-s390, lkml, sparclinux
Reply to
Christophe Leroy, 2022-06-14
rnel@esmil.dk>, Jordan Niethe [off-list ref], Atish Patra [off-list ref], Alexei Starovoitov [off-list ref], Will Deacon [off-list ref], Masahiro Yamada [off-list ref], Jarkko Sakkinen [off-list ref], Sami Tolvanen [off-list ref], "Naveen N. Rao" [off-list ref], Marco Elver [off-list ref], Kees Cook [off-list ref], Steven Rostedt [off-list ref], Nathan Chancellor [off-list ref], Mark Brown [off-list ref], Borislav Petkov [off-list ref], Alexander Egorenkov [off-list ref], Thomas Bogendoerfer [off-list ref], "linux-parisc@vger.kernel.org" [off-list ref], Nathaniel McCallum [off-list ref], Dmitry Torokhov [off-list ref], "David S. Miller" [off-list ref], "Kirill A. Shutemov" [off-list ref], Tobias Huschle [off-list ref], "Peter Zijlstra \(Intel\)" [off-list ref], "H. Peter Anvin" [off-list ref]
 , "sparclinux@vger.kernel.org" [off-list ref], Tiezhu Yang [off-list ref], Miroslav Benes [off-list ref], Chen Zhongjin [off-list ref], Ard Biesheuvel [off-list ref], "x86@kernel.org" [off-list ref], "Russell King \(Oracle\)" [off-list ref], "linux-riscv@lists.infradead.org" [off-list ref], Ingo Molnar [off-list ref], Aaron Tomlin [off-list ref], Albert Ou [off-list ref], Heiko Carstens [off-list ref], Liao Chang [off-list ref], Paul Walmsley [off-list ref], Josh Poimboeuf [off-list ref], Thomas Richter [off-list ref], "linux-mips@vger.kernel.org" [off-list ref], Changbin Du [off-list ref], Palmer Dabbelt [off-list ref], "linuxppc-dev@lists.ozlabs.org" [off-list ref], "linux-modules@vger.kernel.org" [off-list ref]
Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org
Sender: "Linuxppc-dev" [off-list ref]

On Tue, Jun 14, 2022 at 12:36:25PM +0000, Christophe Leroy wrote:

Le 14/06/2022 à 14:26, Jarkko Sakkinen a écrit :
quoted
On Thu, Jun 09, 2022 at 06:44:45AM -0700, Luis Chamberlain wrote:
quoted
On Thu, Jun 09, 2022 at 08:47:38AM +0100, Russell King (Oracle) wrote:
quoted
On Wed, Jun 08, 2022 at 02:59:27AM +0300, Jarkko Sakkinen wrote:
quoted
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?
I guess you have two possible approaches.

Either architectures select CONFIG_ARCH_HAS_VMALLOC_EXEC at all time and 
then you add a CONFIG_VMALLOC_EXEC which depends on 
CONFIG_ARCH_HAS_VMALLOC_EXEC and CONFIG_MODULES or CONFIG_KPROBES,

Or architectures select CONFIG_ARCH_HAS_VMALLOC_EXEC only when either 
CONFIG_MODULES or CONFIG_KPROBES is selected, in that case there is no 
need for a CONFIG_VMALLOC_EXEC.
Right, got it now. Thanks for the elaboration.
Christophe
BR, Jarkko
Thread (37 messages) 37 messages, 11 authors, last reply 2022-06-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help