public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/execmem: fix ROX cache usage in Xen PV guests
@ 2025-01-03  6:56 Juergen Gross
  2025-01-03 13:00 ` Borislav Petkov
  0 siblings, 1 reply; 6+ messages in thread
From: Juergen Gross @ 2025-01-03  6:56 UTC (permalink / raw)
  To: linux-kernel, x86
  Cc: Juergen Gross, Dave Hansen, Andy Lutomirski, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
	Marek Marczykowski-Górecki

The recently introduced ROX cache for modules is assuming large page
support in 64-bit mode without testing the related feature bit. This
results in breakage when running as a Xen PV guest, as in this mode
large pages are not supported.

Fix that by testing the X86_FEATURE_PSE capability when deciding
whether to enable the ROX cache.

Fixes: 2e45474ab14f ("execmem: add support for cache of large ROX pages")
Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
---
 arch/x86/mm/init.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index c6d29f283001..62aa4d66a032 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -1080,7 +1080,8 @@ struct execmem_info __init *execmem_arch_setup(void)
 
 	start = MODULES_VADDR + offset;
 
-	if (IS_ENABLED(CONFIG_ARCH_HAS_EXECMEM_ROX)) {
+	if (IS_ENABLED(CONFIG_ARCH_HAS_EXECMEM_ROX) &&
+	    cpu_feature_enabled(X86_FEATURE_PSE)) {
 		pgprot = PAGE_KERNEL_ROX;
 		flags = EXECMEM_KASAN_SHADOW | EXECMEM_ROX_CACHE;
 	} else {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-13 20:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-03  6:56 [PATCH] x86/execmem: fix ROX cache usage in Xen PV guests Juergen Gross
2025-01-03 13:00 ` Borislav Petkov
2025-01-10 10:02   ` Mike Rapoport
2025-01-13 17:55     ` Borislav Petkov
2025-01-13 20:10       ` Marek Marczykowski-Górecki
2025-01-13 20:19         ` Borislav Petkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox