* [PATCH] powerpc/Kconfig: limit the PPC_85xx DATA_SHIFT range to STRICT_KERNEL_RWX
@ 2026-10-11 11:31 Julian Braha
2026-10-12 10:28 ` Christophe Leroy (CS GROUP)
0 siblings, 1 reply; 4+ messages in thread
From: Julian Braha @ 2026-10-11 11:31 UTC (permalink / raw)
To: maddy
Cc: mpe, npiggin, chleroy, ritesh.list, sshegde, linuxppc-dev,
linux-kernel, Julian Braha
On PPC_85xx, enabling DEBUG_PAGEALLOC without STRICT_KERNEL_RWX activates
the DATA_SHIFT range of 20..24, but since the PAGE_SHIFT default is
outside the range (12), kconfig adjusts it to 20, causing 1mb alignment
instead of 4kb. However, the larger alignment is only needed for the
separate kernel permissions provided by STRICT_KERNEL_RWX.
Since PPC_85xx uses page poisoning for DEBUG_PAGEALLOC and does not
support KFENCE, let's restrict this range to STRICT_KERNEL_RWX.
This out-of-range default was detected by kconfirm, a static analysis tool
for Kconfig.
Signed-off-by: Julian Braha <julianbraha@gmail.com>
---
arch/powerpc/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index c3b6cd655606..5e2a4799438d 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -896,7 +896,7 @@ config DATA_SHIFT
default 24 if STRICT_KERNEL_RWX && PPC64
range 17 28 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32
range 14 23 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_8xx
- range 20 24 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_85xx
+ range 20 24 if STRICT_KERNEL_RWX && PPC_85xx
default 22 if STRICT_KERNEL_RWX && PPC_BOOK3S_32
default 18 if (DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32
default 23 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_8xx && \
--
2.55.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/Kconfig: limit the PPC_85xx DATA_SHIFT range to STRICT_KERNEL_RWX
2026-10-11 11:31 [PATCH] powerpc/Kconfig: limit the PPC_85xx DATA_SHIFT range to STRICT_KERNEL_RWX Julian Braha
@ 2026-10-12 10:28 ` Christophe Leroy (CS GROUP)
2026-10-14 11:23 ` Julian Braha
0 siblings, 1 reply; 4+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-10-12 10:28 UTC (permalink / raw)
To: Julian Braha, maddy
Cc: mpe, npiggin, ritesh.list, sshegde, linuxppc-dev, linux-kernel
Le 11/10/2026 à 13:31, Julian Braha a écrit :
> On PPC_85xx, enabling DEBUG_PAGEALLOC without STRICT_KERNEL_RWX activates
> the DATA_SHIFT range of 20..24, but since the PAGE_SHIFT default is
> outside the range (12), kconfig adjusts it to 20, causing 1mb alignment
> instead of 4kb. However, the larger alignment is only needed for the
> separate kernel permissions provided by STRICT_KERNEL_RWX.
>
> Since PPC_85xx uses page poisoning for DEBUG_PAGEALLOC and does not
> support KFENCE, let's restrict this range to STRICT_KERNEL_RWX.
>
> This out-of-range default was detected by kconfirm, a static analysis tool
> for Kconfig.
Looks like with this change I'm now able to set DATA_SHIFT to any value
when STRICT_KERNEL_RWX is not set and DEBUG_PAGEALLOC is set.
The range used to protect against that.
> > Signed-off-by: Julian Braha <julianbraha@gmail.com>
> ---
> arch/powerpc/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index c3b6cd655606..5e2a4799438d 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -896,7 +896,7 @@ config DATA_SHIFT
> default 24 if STRICT_KERNEL_RWX && PPC64
> range 17 28 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32
> range 14 23 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_8xx
> - range 20 24 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_85xx
> + range 20 24 if STRICT_KERNEL_RWX && PPC_85xx
> default 22 if STRICT_KERNEL_RWX && PPC_BOOK3S_32
> default 18 if (DEBUG_PAGEALLOC || KFENCE) && PPC_BOOK3S_32
> default 23 if (STRICT_KERNEL_RWX || DEBUG_PAGEALLOC || KFENCE) && PPC_8xx && \
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] powerpc/Kconfig: limit the PPC_85xx DATA_SHIFT range to STRICT_KERNEL_RWX
2026-10-12 10:28 ` Christophe Leroy (CS GROUP)
@ 2026-10-14 11:23 ` Julian Braha
2026-10-14 12:39 ` Christophe Leroy (CS GROUP)
0 siblings, 1 reply; 4+ messages in thread
From: Julian Braha @ 2026-10-14 11:23 UTC (permalink / raw)
To: Christophe Leroy (CS GROUP), maddy
Cc: mpe, npiggin, ritesh.list, sshegde, linuxppc-dev, linux-kernel
On 10/12/26 11:28, Christophe Leroy (CS GROUP) wrote:
> Le 11/10/2026 à 13:31, Julian Braha a écrit :
>> On PPC_85xx, enabling DEBUG_PAGEALLOC without STRICT_KERNEL_RWX activates
>> the DATA_SHIFT range of 20..24, but since the PAGE_SHIFT default is
>> outside the range (12), kconfig adjusts it to 20, causing 1mb alignment
>> instead of 4kb. However, the larger alignment is only needed for the
>> separate kernel permissions provided by STRICT_KERNEL_RWX.
>>
>> Since PPC_85xx uses page poisoning for DEBUG_PAGEALLOC and does not
>> support KFENCE, let's restrict this range to STRICT_KERNEL_RWX.
>>
>> This out-of-range default was detected by kconfirm, a static analysis
>> tool
>> for Kconfig.
>
> Looks like with this change I'm now able to set DATA_SHIFT to any value
> when STRICT_KERNEL_RWX is not set and DEBUG_PAGEALLOC is set.
>
> The range used to protect against that.
Sorry, yeah kconfig can be tricky...
> + range 20 24 if STRICT_KERNEL_RWX && PPC_85xx
I think if we keep this ^ and then add another range:
range PAGE_SHIFT 24 if !STRICT_KERNEL_RWX && PPC_85xx
this would cover your STRICT_KERNEL_RWX=n and DEBUG_PAGEALLOC=y
configuration while resolving the 12 -> 20
- Julian Braha
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] powerpc/Kconfig: limit the PPC_85xx DATA_SHIFT range to STRICT_KERNEL_RWX
2026-10-14 11:23 ` Julian Braha
@ 2026-10-14 12:39 ` Christophe Leroy (CS GROUP)
0 siblings, 0 replies; 4+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2026-10-14 12:39 UTC (permalink / raw)
To: Julian Braha, maddy
Cc: mpe, npiggin, ritesh.list, sshegde, linuxppc-dev, linux-kernel
Le 14/10/2026 à 13:23, Julian Braha a écrit :
> On 10/12/26 11:28, Christophe Leroy (CS GROUP) wrote:
>> Le 11/10/2026 à 13:31, Julian Braha a écrit :
>>> On PPC_85xx, enabling DEBUG_PAGEALLOC without STRICT_KERNEL_RWX activates
>>> the DATA_SHIFT range of 20..24, but since the PAGE_SHIFT default is
>>> outside the range (12), kconfig adjusts it to 20, causing 1mb alignment
>>> instead of 4kb. However, the larger alignment is only needed for the
>>> separate kernel permissions provided by STRICT_KERNEL_RWX.
>>>
>>> Since PPC_85xx uses page poisoning for DEBUG_PAGEALLOC and does not
>>> support KFENCE, let's restrict this range to STRICT_KERNEL_RWX.
>>>
>>> This out-of-range default was detected by kconfirm, a static analysis
>>> tool
>>> for Kconfig.
>>
>> Looks like with this change I'm now able to set DATA_SHIFT to any value
>> when STRICT_KERNEL_RWX is not set and DEBUG_PAGEALLOC is set.
>>
>> The range used to protect against that.
>
> Sorry, yeah kconfig can be tricky...
>
>> + range 20 24 if STRICT_KERNEL_RWX && PPC_85xx
> I think if we keep this ^ and then add another range:
>
> range PAGE_SHIFT 24 if !STRICT_KERNEL_RWX && PPC_85xx
>
> this would cover your STRICT_KERNEL_RWX=n and DEBUG_PAGEALLOC=y
> configuration while resolving the 12 -> 20
Yes I think that should work.
Christophe
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-14 12:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-11 11:31 [PATCH] powerpc/Kconfig: limit the PPC_85xx DATA_SHIFT range to STRICT_KERNEL_RWX Julian Braha
2026-10-12 10:28 ` Christophe Leroy (CS GROUP)
2026-10-14 11:23 ` Julian Braha
2026-10-14 12:39 ` Christophe Leroy (CS GROUP)
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®