x86/kprobes: enable EXECMEM_ROX_CACHE for kprobes allocations
authorMike Rapoport (Microsoft) <rppt@kernel.org>
Sun, 13 Jul 2025 07:17:29 +0000 (10:17 +0300)
committerAndrew Morton <akpm@linux-foundation.org>
Sat, 2 Aug 2025 19:06:12 +0000 (12:06 -0700)
commit36de1e4238c1243866eaec515ef59972c490367f
treeffa9e2dd5cefb968fc2a6b04a0dd057724040763
parentab674b6871b049aab2e86d1d7375526368ed175a
x86/kprobes: enable EXECMEM_ROX_CACHE for kprobes allocations

x86::alloc_insn_page() always allocates ROX memory.

Instead of overriding this method, add EXECMEM_KPROBES entry in
execmem_info with pgprot set to PAGE_KERNEL_ROX and use ROX cache when
configuration and CPU features allow it.

Link: https://lkml.kernel.org/r/20250713071730.4117334-8-rppt@kernel.org
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Daniel Gomez <da.gomez@samsung.com>
Cc: Petr Pavlu <petr.pavlu@suse.com>
Cc: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/x86/kernel/kprobes/core.c
arch/x86/mm/init.c