[PATCH -next v14 14/19] riscv: signal: Report signal frame size to userspace via auxv

Conor Dooley conor at kernel.org
Wed Mar 1 11:21:27 PST 2023


On Fri, Feb 24, 2023 at 05:01:13PM +0000, Andy Chiu wrote:
> From: Vincent Chen <vincent.chen at sifive.com>
> 
> 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^(XLEN-1). 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 <greentime.hu at sifive.com>
> Signed-off-by: Vincent Chen <vincent.chen at sifive.com>
> Signed-off-by: Andy Chiu <andy.chiu at sifive.com>

Acked-by: Conor Dooley <conor.dooley at microchip.com>

Thanks,
Conor.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20230301/27ad0c21/attachment.sig>


More information about the linux-riscv mailing list