From: Heiko Stübner Date: Sun, 02 Apr 2023 00:19:49 +0200 Subject: [PATCH -next v17 14/20] riscv: signal: Report signal frame size to userspace via auxv In-Reply-To: <20230327164941.20491-15-andy.chiu@sifive.com> References: <20230327164941.20491-1-andy.chiu@sifive.com> <20230327164941.20491-15-andy.chiu@sifive.com> Message-ID: <37344569.XM6RcZxFsP@diego> List-Id: To: kvm-riscv@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Am Montag, 27. M?rz 2023, 18:49:34 CEST schrieb Andy Chiu: > From: Vincent Chen > > The vector register belongs to the signal context. They need to be stored > and restored as entering and leaving the signal handler. According to the > V-extension specification, the maximum length of the vector registers can > be 2^16. Hence, if userspace refers to the MINSIGSTKSZ to create a > sigframe, it may not be enough. To resolve this problem, this patch refers > to the commit 94b07c1f8c39c > ("arm64: signal: Report signal frame size to userspace via auxv") to enable > userspace to know the minimum required sigframe size through the auxiliary > vector and use it to allocate enough memory for signal context. > > Note that auxv always reports size of the sigframe as if V exists for > all starting processes, whenever the kernel has CONFIG_RISCV_ISA_V. The > reason is that users usually reference this value to allocate an > alternative signal stack, and the user may use V anytime. So the user > must reserve a space for V-context in sigframe in case that the signal > handler invokes after the kernel allocating V. > > Signed-off-by: Greentime Hu > Signed-off-by: Vincent Chen > Signed-off-by: Andy Chiu > Acked-by: Conor Dooley > Reviewed-by: Bj?rn T?pel > Reviewed-by: Guo Ren Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner