[PATCH -next v14 15/19] riscv: signal: validate altstack to reflect Vector

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



MINSIGSTKSZ alone have become less informative by the time an user calls
sigaltstack(), as the kernel starts to support extensions that
dynamically introduce footprint on a signal frame. For example, an RV64V
implementation with vlen = 512 may occupy 2K + 40 + 12 Bytes of a signal
frame with the upcoming Vector support. And there is no need for
reserving the extra sigframe for some processes that do not execute any
V-instructions.

Thus, provide the function sigaltstack_size_valid() to validate its size
based on current allocation status of supported extensions.

Signed-off-by: Andy Chiu <andy.chiu@xxxxxxxxxx>
---
 arch/riscv/kernel/signal.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/riscv/kernel/signal.c b/arch/riscv/kernel/signal.c
index aa8ee95dee2d..aff441e83a98 100644
--- a/arch/riscv/kernel/signal.c
+++ b/arch/riscv/kernel/signal.c
@@ -494,3 +494,11 @@ void __init init_rt_signal_env(void)
 	 */
 	signal_minsigstksz = cal_rt_frame_size(true);
 }
+
+#ifdef CONFIG_DYNAMIC_SIGFRAME
+bool sigaltstack_size_valid(size_t ss_size)
+{
+	return ss_size > cal_rt_frame_size(false);
+}
+#endif /* CONFIG_DYNAMIC_SIGFRAME */
+
-- 
2.17.1




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux