summaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python/stat-cpi.py
diff options
context:
space:
mode:
authorZong Li <zong.li@sifive.com>2026-04-27 19:41:05 -0700
committerPaul Walmsley <pjw@kernel.org>2026-05-13 19:07:12 -0600
commit6c7674b5b7ae513cecae22aa9dcdcf533862cf5c (patch)
tree56ab946b7fbf352e6b04375f01d8d3cbca3db7a0 /tools/perf/scripts/python/stat-cpi.py
parent41337097f2823e99478d7cbe68d4893582ed0b18 (diff)
downloadlinux-6c7674b5b7ae513cecae22aa9dcdcf533862cf5c.tar.gz
linux-6c7674b5b7ae513cecae22aa9dcdcf533862cf5c.zip
riscv: cfi: reduce shadow stack size limit from 4GB to 2GB
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 margin while being more resource-efficient. 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. Signed-off-by: Zong Li <zong.li@sifive.com> Link: https://patch.msgid.link/20260428024105.645162-1-zong.li@sifive.com [pjw@kernel.org: clean up patch description] Signed-off-by: Paul Walmsley <pjw@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/stat-cpi.py')
0 files changed, 0 insertions, 0 deletions