On Thu, 11 Dec 2025, Deepak Gupta via B4 Relay wrote:

> From: Deepak Gupta <[email protected]>
> 
> VM_HIGH_ARCH_5 is used for riscv
> 
> Reviewed-by: Zong Li <[email protected]>
> Reviewed-by: Alexandre Ghiti <[email protected]>
> Acked-by: David Hildenbrand <[email protected]>
> Tested-by: Andreas Korb <[email protected]>
> Tested-by: Valentin Haudiquet <[email protected]>
> Signed-off-by: Deepak Gupta <[email protected]>

Here's what I'm planning to queue, after updating it after Lorenzo's mm 
changes.  Please let me know if you want to change anything.


- Paul

From: Deepak Gupta <[email protected]>
Date: Wed, 19 Nov 2025 09:55:05 -0700

mm: add VM_SHADOW_STACK definition for riscv

VM_HIGH_ARCH_5 is used for riscv.

Reviewed-by: Zong Li <[email protected]>
Reviewed-by: Alexandre Ghiti <[email protected]>
Acked-by: David Hildenbrand <[email protected]>
Signed-off-by: Deepak Gupta <[email protected]>
Tested-by: Andreas Korb <[email protected]> # QEMU, custom CVA6
Tested-by: Valentin Haudiquet <[email protected]>
Link: 
https://patch.msgid.link/[email protected]
[[email protected]: clarify subject; update to apply]
Signed-off-by: Paul Walmsley <[email protected]>
---
 include/linux/mm.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 15076261d0c2..de912272c5f9 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -359,7 +359,7 @@ enum {
        DECLARE_VMA_BIT_ALIAS(PKEY_BIT2, HIGH_ARCH_2),
        DECLARE_VMA_BIT_ALIAS(PKEY_BIT3, HIGH_ARCH_3),
        DECLARE_VMA_BIT_ALIAS(PKEY_BIT4, HIGH_ARCH_4),
-#if defined(CONFIG_X86_USER_SHADOW_STACK)
+#if defined(CONFIG_X86_USER_SHADOW_STACK) || defined(CONFIG_RISCV_USER_CFI)
        /*
         * VM_SHADOW_STACK should not be set with VM_SHARED because of lack of
         * support core mm.
@@ -460,7 +460,8 @@ enum {
 #define VM_PKEY_BIT4  VM_NONE
 #endif /* CONFIG_ARCH_PKEY_BITS > 4 */
 #endif /* CONFIG_ARCH_HAS_PKEYS */
-#if defined(CONFIG_X86_USER_SHADOW_STACK) || defined(CONFIG_ARM64_GCS)
+#if defined(CONFIG_X86_USER_SHADOW_STACK) || defined(CONFIG_ARM64_GCS) || \
+       defined(CONFIG_RISCV_USER_CFI)
 #define VM_SHADOW_STACK        INIT_VM_FLAG(SHADOW_STACK)
 #else
 #define VM_SHADOW_STACK        VM_NONE
-- 
2.51.0





Reply via email to