[PATCH v4 06/22] aarch64: Add GCS support to vfork

Carlos O'Donell codonell@redhat.com
Mon Dec 2 21:47:48 GMT 2024


On 11/29/24 11:37 AM, Yury Khrustalev wrote:
> From: Szabolcs Nagy <szabolcs.nagy@arm.com>
> 
> ---

This makes all aarch64 builds jump to the child via br,
is there any consequence to that?

>  sysdeps/unix/sysv/linux/aarch64/vfork.S | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/aarch64/vfork.S b/sysdeps/unix/sysv/linux/aarch64/vfork.S
> index e71e492da3..cfaf4a1ffb 100644
> --- a/sysdeps/unix/sysv/linux/aarch64/vfork.S
> +++ b/sysdeps/unix/sysv/linux/aarch64/vfork.S
> @@ -33,8 +33,14 @@ ENTRY (__vfork)
>  
>  	cmn	x0, #4095
>  	b.cs    .Lsyscall_error
> +	cbz	x0, L(child)

OK. Child sees zero.

>  	RET
> -
> +L(child):
> +	/* Return with indirect branch in the child to support GCS.
> +	   Clear x30 to crash early if the child tries to ret.  */
> +	mov	x1, x30
> +	mov	x30, 0
> +	br	x1

OK. Always use br in child.

>  PSEUDO_END (__vfork)
>  libc_hidden_def (__vfork)
>  



More information about the Libc-alpha mailing list