* [PATCH] x86/Kconfig: enable ROX also when STRICT_KERNEL_RWX is present
@ 2026-06-25 9:06 Richard Weinberger
2026-06-25 9:17 ` Mike Rapoport
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Richard Weinberger @ 2026-06-25 9:06 UTC (permalink / raw)
To: linux-kernel
Cc: upstream+x86, rppt, peterz, hpa, x86, dave.hansen, bp, mingo,
tglx, Richard Weinberger, stable
Running a kernel with CONFIG_MODULES=n causes the W+X page dectection
to trigger:
x86/mm: Found insecure W+X mapping at address 0xffffffffc033a000
The W+X pages come from __its_alloc() with type being EXECMEM_MODULE_TEXT.
Without ARCH_HAS_EXECMEM_ROX pgprot is PAGE_KERNEL instead of
PAGE_KERNEL_ROX.
Cc: stable@vger.kernel.org
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
Fixes: 47410d839fcda ("x86/Kconfig: only enable ROX cache in execmem when STRICT_MODULE_RWX is set")
Suggested-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
---
arch/x86/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 0b5f30d769ffb..330ccbf6726ad 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -85,7 +85,7 @@ config X86
select ARCH_HAS_DMA_OPS if GART_IOMMU || XEN
select ARCH_HAS_EARLY_DEBUG if KGDB
select ARCH_HAS_ELF_RANDOMIZE
- select ARCH_HAS_EXECMEM_ROX if X86_64 && STRICT_MODULE_RWX
+ select ARCH_HAS_EXECMEM_ROX if X86_64 && (STRICT_MODULE_RWX || STRICT_KERNEL_RWX)
select ARCH_HAS_FAST_MULTIPLIER
select ARCH_HAS_FORTIFY_SOURCE
select ARCH_HAS_GCOV_PROFILE_ALL
--
2.51.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/Kconfig: enable ROX also when STRICT_KERNEL_RWX is present
2026-06-25 9:06 [PATCH] x86/Kconfig: enable ROX also when STRICT_KERNEL_RWX is present Richard Weinberger
@ 2026-06-25 9:17 ` Mike Rapoport
2026-06-25 9:19 ` Peter Zijlstra
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Mike Rapoport @ 2026-06-25 9:17 UTC (permalink / raw)
To: Richard Weinberger
Cc: linux-kernel, upstream+x86, peterz, hpa, x86, dave.hansen, bp,
mingo, tglx, stable
On Thu, Jun 25, 2026 at 11:06:27AM +0200, Richard Weinberger wrote:
> Running a kernel with CONFIG_MODULES=n causes the W+X page dectection
> to trigger:
> x86/mm: Found insecure W+X mapping at address 0xffffffffc033a000
>
> The W+X pages come from __its_alloc() with type being EXECMEM_MODULE_TEXT.
> Without ARCH_HAS_EXECMEM_ROX pgprot is PAGE_KERNEL instead of
> PAGE_KERNEL_ROX.
>
> Cc: stable@vger.kernel.org
> Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
> Fixes: 47410d839fcda ("x86/Kconfig: only enable ROX cache in execmem when STRICT_MODULE_RWX is set")
> Suggested-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> Signed-off-by: Richard Weinberger <richard@nod.at>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
> arch/x86/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 0b5f30d769ffb..330ccbf6726ad 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -85,7 +85,7 @@ config X86
> select ARCH_HAS_DMA_OPS if GART_IOMMU || XEN
> select ARCH_HAS_EARLY_DEBUG if KGDB
> select ARCH_HAS_ELF_RANDOMIZE
> - select ARCH_HAS_EXECMEM_ROX if X86_64 && STRICT_MODULE_RWX
> + select ARCH_HAS_EXECMEM_ROX if X86_64 && (STRICT_MODULE_RWX || STRICT_KERNEL_RWX)
> select ARCH_HAS_FAST_MULTIPLIER
> select ARCH_HAS_FORTIFY_SOURCE
> select ARCH_HAS_GCOV_PROFILE_ALL
> --
> 2.51.0
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/Kconfig: enable ROX also when STRICT_KERNEL_RWX is present
2026-06-25 9:06 [PATCH] x86/Kconfig: enable ROX also when STRICT_KERNEL_RWX is present Richard Weinberger
2026-06-25 9:17 ` Mike Rapoport
@ 2026-06-25 9:19 ` Peter Zijlstra
2026-11-21 15:30 ` Vinny Horgan
2026-11-21 19:22 ` [tip: x86/urgent] x86/Kconfig: Enable " tip-bot2 for Richard Weinberger
3 siblings, 0 replies; 5+ messages in thread
From: Peter Zijlstra @ 2026-06-25 9:19 UTC (permalink / raw)
To: Richard Weinberger
Cc: linux-kernel, upstream+x86, rppt, hpa, x86, dave.hansen, bp,
mingo, tglx, stable
On Thu, Jun 25, 2026 at 11:06:27AM +0200, Richard Weinberger wrote:
> Running a kernel with CONFIG_MODULES=n causes the W+X page dectection
> to trigger:
> x86/mm: Found insecure W+X mapping at address 0xffffffffc033a000
>
> The W+X pages come from __its_alloc() with type being EXECMEM_MODULE_TEXT.
> Without ARCH_HAS_EXECMEM_ROX pgprot is PAGE_KERNEL instead of
> PAGE_KERNEL_ROX.
>
> Cc: stable@vger.kernel.org
> Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
> Fixes: 47410d839fcda ("x86/Kconfig: only enable ROX cache in execmem when STRICT_MODULE_RWX is set")
> Suggested-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> Signed-off-by: Richard Weinberger <richard@nod.at>
> ---
> arch/x86/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 0b5f30d769ffb..330ccbf6726ad 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -85,7 +85,7 @@ config X86
> select ARCH_HAS_DMA_OPS if GART_IOMMU || XEN
> select ARCH_HAS_EARLY_DEBUG if KGDB
> select ARCH_HAS_ELF_RANDOMIZE
> - select ARCH_HAS_EXECMEM_ROX if X86_64 && STRICT_MODULE_RWX
> + select ARCH_HAS_EXECMEM_ROX if X86_64 && (STRICT_MODULE_RWX || STRICT_KERNEL_RWX)
> select ARCH_HAS_FAST_MULTIPLIER
> select ARCH_HAS_FORTIFY_SOURCE
> select ARCH_HAS_GCOV_PROFILE_ALL
I wonder, is STRICT_KERNEL_RWX=y, MODULE=y, STRICT_MODULE_RWX=n at all
possible? ;-) That seems an eminently insane combo.
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] x86/Kconfig: enable ROX also when STRICT_KERNEL_RWX is present
2026-06-25 9:06 [PATCH] x86/Kconfig: enable ROX also when STRICT_KERNEL_RWX is present Richard Weinberger
2026-06-25 9:17 ` Mike Rapoport
2026-06-25 9:19 ` Peter Zijlstra
@ 2026-11-21 15:30 ` Vinny Horgan
2026-11-21 19:22 ` [tip: x86/urgent] x86/Kconfig: Enable " tip-bot2 for Richard Weinberger
3 siblings, 0 replies; 5+ messages in thread
From: Vinny Horgan @ 2026-11-21 15:30 UTC (permalink / raw)
To: Richard Weinberger
Cc: linux-kernel, upstream+x86, rppt, peterz, hpa, x86, dave.hansen,
bp, mingo, tglx, stable
On Thu, Jun 25, 2026 at 11:06:27AM +0200, Richard Weinberger wrote:
> Running a kernel with CONFIG_MODULES=n causes the W+X page dectection
> to trigger:
> x86/mm: Found insecure W+X mapping at address 0xffffffffc033a000
Same here, on a ThinkPad T490 (i5-8365U; "Spectre V2 : Mitigation:
Enhanced / Automatic IBRS", "ITS: Mitigation: Aligned branch/return
thunks") with a CONFIG_MODULES=n kernel based on 7.3.4:
x86/mm: Found insecure W+X mapping at address 0xffffffffc03f3000
With this patch on top of 7.3.5, the same machine and config boot with
"x86/mm: Checked W+X mappings: passed, no W+X pages found."
Tested-by: Vinny Horgan <vinnyhorgan@gmail.com>
It doesn't seem to have been applied yet: arch/x86/Kconfig in v7.4-rc3,
tip/master and next-20261120 still has the old condition.
QEMU without KVM could not reproduce it: TCG offers no IBRS, so
spectre_v2 falls back to retpolines and no ITS thunk pages are
allocated, with or without indirect_target_selection=force.
I found this, and wrote this reply, with the help of an AI assistant
(Claude) while building a custom kernel for the T490; the results above
are from that machine.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip: x86/urgent] x86/Kconfig: Enable ROX also when STRICT_KERNEL_RWX is present
2026-06-25 9:06 [PATCH] x86/Kconfig: enable ROX also when STRICT_KERNEL_RWX is present Richard Weinberger
` (2 preceding siblings ...)
2026-11-21 15:30 ` Vinny Horgan
@ 2026-11-21 19:22 ` tip-bot2 for Richard Weinberger
3 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Richard Weinberger @ 2026-11-21 19:22 UTC (permalink / raw)
To: linux-tip-commits
Cc: Mike Rapoport (Microsoft),
Richard Weinberger, Borislav Petkov (AMD), Peter Zijlstra (Intel),
Vinny Horgan, stable, x86, linux-kernel
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: ae3398a7da224e1cb14a04ce8e9da66fc2948121
Gitweb: https://git.kernel.org/tip/ae3398a7da224e1cb14a04ce8e9da66fc2948121
Author: Richard Weinberger <richard@nod.at>
AuthorDate: Thu, 25 Jun 2026 11:06:27 +02:00
Committer: Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Sat, 21 Nov 2026 11:06:09 -08:00
x86/Kconfig: Enable ROX also when STRICT_KERNEL_RWX is present
Running a kernel with CONFIG_MODULES=n causes the W+X page detection
to trigger:
x86/mm: Found insecure W+X mapping at address 0xffffffffc033a000
The W+X pages come from __its_alloc() with type being EXECMEM_MODULE_TEXT.
Without ARCH_HAS_EXECMEM_ROX pgprot is PAGE_KERNEL instead of PAGE_KERNEL_ROX.
Fixes: 47410d839fcda ("x86/Kconfig: only enable ROX cache in execmem when STRICT_MODULE_RWX is set")
Suggested-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Tested-by: Vinny Horgan <vinnyhorgan@gmail.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260625090627.1501095-1-richard@nod.at
---
arch/x86/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 58dce0b..3159852 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -84,7 +84,7 @@ config X86
select ARCH_HAS_DMA_OPS if GART_IOMMU || XEN
select ARCH_HAS_EARLY_DEBUG if KGDB
select ARCH_HAS_ELF_RANDOMIZE
- select ARCH_HAS_EXECMEM_ROX if X86_64 && STRICT_MODULE_RWX
+ select ARCH_HAS_EXECMEM_ROX if X86_64 && (STRICT_MODULE_RWX || STRICT_KERNEL_RWX)
select ARCH_HAS_FAST_MULTIPLIER
select ARCH_HAS_FORTIFY_SOURCE
select ARCH_HAS_GCOV_PROFILE_ALL
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-21 19:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-25 9:06 [PATCH] x86/Kconfig: enable ROX also when STRICT_KERNEL_RWX is present Richard Weinberger
2026-06-25 9:17 ` Mike Rapoport
2026-06-25 9:19 ` Peter Zijlstra
2026-11-21 15:30 ` Vinny Horgan
2026-11-21 19:22 ` [tip: x86/urgent] x86/Kconfig: Enable " tip-bot2 for Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®