[PW_SID:1057353] mm: arch/shstk: Common shadow stack mapping helper and VM_NOHUGEPAGE#1493
[PW_SID:1057353] mm: arch/shstk: Common shadow stack mapping helper and VM_NOHUGEPAGE#1493linux-riscv-bot wants to merge 5 commits intoworkflow__riscv__fixesfrom
Conversation
…mappings arm64, riscv and x86 use a similar pattern for mapping the user shadow stack (cloned from x86). Extract this into a helper to facilitate code reuse. The call to do_mmap() from the new helper uses PROT_READ|PROT_WRITE prot bits instead of the PROT_READ with an explicit VM_WRITE vm_flag. The x86 intent was to avoid PROT_WRITE implying normal write since the shadow stack is not writable by normal stores. However, from a kernel perspective, the vma is writeable. Functionally there is no difference. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: David Hildenbrand <david@kernel.org> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Replace the arm64 map_shadow_stack() content with a call to vm_mmap_shadow_stack(). Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Replace part of the allocate_shadow_stack() content with a call to vm_mmap_shadow_stack(). Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Paul Walmsley <pjw@kernel.org> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Alexandre Ghiti <alex@ghiti.fr> Cc: Deepak Gupta <debug@rivosinc.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Replace part of the x86 alloc_shstk() content with a call to vm_mmap_shadow_stack(). Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Thomas Gleixner <tglx@kernel.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Borislav Petkov <bp@alien8.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Rick Edgecombe <rick.p.edgecombe@intel.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The default shadow stack size allocated on first prctl() for the main thread or subsequently on clone() is either half of RLIMIT_STACK or half of a thread's stack size (for arm64). Both of these are likely to be suitable for a THP allocation and the kernel is more aggressive in creating such mappings. However, it does not make much sense to use a huge page. It didn't make sense for the normal stacks either, see commit c4608d1 ("mm: mmap: map MAP_STACK to VM_NOHUGEPAGE"). Force VM_NOHUGEPAGE when allocating/mapping the shadow stack. As per commit 7190b3c ("mm: mmap: map MAP_STACK to VM_NOHUGEPAGE only if THP is enabled"), only pass this flag if TRANSPARENT_HUGEPAGE is enabled as not to confuse CRIU tools. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: David Hildenbrand <david@kernel.org> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
|
Patch 5: "[5/5] mm: Do not map the shadow stack as THP" |
PR for series 1057353 applied to workflow__riscv__fixes
Name: mm: arch/shstk: Common shadow stack mapping helper and VM_NOHUGEPAGE
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1057353
Version: 1