Skip to content

Comments

[PW_SID:1057353] mm: arch/shstk: Common shadow stack mapping helper and VM_NOHUGEPAGE#1493

Open
linux-riscv-bot wants to merge 5 commits intoworkflow__riscv__fixesfrom
pw1057353
Open

[PW_SID:1057353] mm: arch/shstk: Common shadow stack mapping helper and VM_NOHUGEPAGE#1493
linux-riscv-bot wants to merge 5 commits intoworkflow__riscv__fixesfrom
pw1057353

Conversation

@linux-riscv-bot
Copy link

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

…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>
@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.91 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1861.72 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 2600.70 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 28.48 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 29.52 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 2.33 seconds
Result: WARNING
Output:

CHECK: extern prototypes should be avoided in .h files
#35: FILE: include/linux/mm.h:3702:
+extern unsigned long __must_check vm_mmap_shadow_stack(unsigned long addr,

CHECK: Alignment should match open parenthesis
#36: FILE: include/linux/mm.h:3703:
+extern unsigned long __must_check vm_mmap_shadow_stack(unsigned long addr,
+	unsigned long len, unsigned long flags);

total: 0 errors, 0 warnings, 2 checks, 41 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

Commit 46004dd3e62e ("mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings") has style problems, please review.

NOTE: Ignored message types: ALLOC_SIZEOF_STRUCT CAMELCASE COMMIT_LOG_LONG_LINE GIT_COMMIT_ID MACRO_ARG_REUSE NO_AUTHOR_SIGN_OFF

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.
total: 0 errors, 0 warnings, 2 checks, 41 lines checked
CHECK: Alignment should match open parenthesis
CHECK: extern prototypes should be avoided in .h files


@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 84.15 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
kdoc
Desc: Detects for kdoc errors
Duration: 1.05 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
module-param
Desc: Detect module_param changes
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[1/5] mm: Introduce vm_mmap_shadow_stack() as a helper for VM_SHADOW_STACK mappings"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.32 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.62 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1004.97 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1341.49 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 28.61 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 30.19 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.84 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 84.02 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
kdoc
Desc: Detects for kdoc errors
Duration: 0.99 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 2: "[2/5] arm64: gcs: Use the new common vm_mmap_shadow_stack() helper"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.32 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.78 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 83.68 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper"
kdoc
Desc: Detects for kdoc errors
Duration: 0.99 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.21 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 3: "[3/5] riscv: shstk: Use the new common vm_mmap_shadow_stack() helper"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 140.57 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 995.80 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1342.70 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 28.92 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 29.88 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.84 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 83.64 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.28 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
kdoc
Desc: Detects for kdoc errors
Duration: 1.01 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 4: "[4/5] x86: shstk: Use the new common vm_mmap_shadow_stack() helper"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 141.11 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1109.93 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1637.34 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 28.75 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 29.86 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 84.20 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
kdoc
Desc: Detects for kdoc errors
Duration: 1.04 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 5: "[5/5] mm: Do not map the shadow stack as THP"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants