Skip to content

Commit 76e22fd

Browse files
AndybnACTpalmer-dabbelt
authored andcommitted
riscv: signal: validate altstack to reflect Vector
Some extensions, such as Vector, dynamically change footprint on a signal frame, so MINSIGSTKSZ is no longer accurate. For example, an RV64V implementation with vlen = 512 may occupy 2K + 40 + 12 Bytes of a signal frame with the upcoming support. And processes that do not execute any vector instructions do not need to reserve the extra sigframe. So we need a way to guard the allocation size of the sigframe at process runtime according to current status of V. Thus, provide the function sigaltstack_size_valid() to validate its size based on current allocation status of supported extensions. Signed-off-by: Andy Chiu <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Reviewed-by: Heiko Stuebner <[email protected]> Tested-by: Heiko Stuebner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent e92f469 commit 76e22fd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

arch/riscv/kernel/signal.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,3 +476,10 @@ void __init init_rt_signal_env(void)
476476
*/
477477
signal_minsigstksz = get_rt_frame_size(true);
478478
}
479+
480+
#ifdef CONFIG_DYNAMIC_SIGFRAME
481+
bool sigaltstack_size_valid(size_t ss_size)
482+
{
483+
return ss_size > get_rt_frame_size(false);
484+
}
485+
#endif /* CONFIG_DYNAMIC_SIGFRAME */

0 commit comments

Comments
 (0)