Skip to content

[PW_SID:1094641] [v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB#1930

Closed
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__for-nextfrom
pw1094641
Closed

[PW_SID:1094641] [v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB#1930
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__for-nextfrom
pw1094641

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 1094641 applied to workflow__riscv__for-next

Name: [v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1094641
Version: 3

Follow the ARM64 GCS (Guarded Control Stack) implementation approach
by reducing the shadow stack size allocation from min(RLIMIT_STACK, 4GB)
to min(RLIMIT_STACK/2, 2GB). see commit '506496bcbb42 "arm64/gcs: Ensure
that new threads have a GCS")'

Rationale:

1. Shadow stacks only store return addresses (8 bytes per entry), not
   local variables, function parameters, or saved registers. A 2GB
   shadow stack is far more than sufficient for any practical
   application, even with extremely deep recursion. Using half the size
   maintains adequate while being more resource-efficient margin

2. On memory-constrained systems (e.g., platforms with only 4GB of
   physical memory, which is a common configuration), allocating 4GB
   of virtual address space for shadow stack per process/thread can
   lead to virtual memory allocation failures when the overcommit mode
   is set to OVERCOMMIT_GUESS or OVERCOMMIT_NEVER:
   Error: "__vm_enough_memory: not enough memory for the allocation"

This reduces virtual address space consumption by 50% while maintaining
more than adequate space for return address storage.

Additionally, add max(PAGE_SIZE, size) constraint, which covers the
case where RLIMIT_STACK is smaller than PAGE_SIZE.

Signed-off-by: Zong Li <zong.li@sifive.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 139.42 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1011.94 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1381.76 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 25.89 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.61 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.80 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 85.19 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
kdoc
Desc: Detects for kdoc errors
Duration: 0.84 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
module-param
Desc: Detect module_param changes
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[v3] riscv: cif: reduce shadow stack size limit from 4GB to 2GB"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot deleted the pw1094641 branch May 19, 2026 08:29
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