aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Chiu <[email protected]>2023-06-05 11:07:13 +0000
committerPalmer Dabbelt <[email protected]>2023-06-08 07:16:48 -0700
commit76e22fdc2c2658ab595cdda7368d43d2dc16f3f4 (patch)
tree712e2ae53164e8deed7f2247ba2758f32c0c7388
parente92f469b0771e6db9688a58c0e34a8342da6a6bc (diff)
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]>
-rw-r--r--arch/riscv/kernel/signal.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c
index f117641c1c49..180d951d3624 100644
--- a/arch/riscv/kernel/signal.c
+++ b/arch/riscv/kernel/signal.c
@@ -476,3 +476,10 @@ void __init init_rt_signal_env(void)
*/
signal_minsigstksz = get_rt_frame_size(true);
}
+
+#ifdef CONFIG_DYNAMIC_SIGFRAME
+bool sigaltstack_size_valid(size_t ss_size)
+{
+ return ss_size > get_rt_frame_size(false);
+}
+#endif /* CONFIG_DYNAMIC_SIGFRAME */