[PATCH v2 0/3] aarch64: support shadow stack in clone3

Yury Khrustalev yury.khrustalev@arm.com
Tue Aug 26 10:33:31 GMT 2025


Hi Florian,

Did you have a chance to have a look at this patch series? Would you
prefer me to rebase it now?

Thanks,
Yury

On Mon, Jul 07, 2025 at 01:47:19PM +0100, Yury Khrustalev wrote:
> Kernel extends clone3() interface to allow specifying a shadow stack
> when creating a new thread or process [1].
> 
> In this patch series we make use of this extended interface on aarch64
> when GCS is available.
> 
> Request for comments.
> 
> Part of the difficulty is versioning of the clone3() syscall in terms of
> the struct clone_args as discussed in [2] and that a system can support
> HWCAP_GCS without supporting extended struct clone_args. We check this
> by doing a dummy clone3 syscall with a specific size of the struct and
> looking for the E2BIG errno.
> 
> Regression was tested on aarch64 and x86, and no regression has been found.
> 
> Corresponding Linux kernel patch is [1] and can be checked out from [3]
> (based on v6.16-rc3) which is the same as [1].
> 
> This change can be tested on the FVP model as described in [4].
> 
> base commit: 6afece738c
> 
> Changes in v2:
>  - Instead of relying on kernel version, we fire a dummy clone3 syscall
>    with a specific size and check if we get the E2BIG error which would
>    indicate that the shadow_stack_token field is not supported in struct
>    clone_args.
>  - Added tests for cancelled and non-started threads to check that
>    shadow stack is de-allocated.
>  - v1: https://inbox.sourceware.org/libc-alpha/20250610151320.885131-1-yury.khrustalev@arm.com/
> 
> [1]: https://lore.kernel.org/all/20250702-clone3-shadow-stack-v18-0-7965d2b694db@kernel.org/
> [2]: https://lore.kernel.org/lkml/aCs65ccRQtJBnZ_5@arm.com/
> [3]: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/ci.git/log/?h=clone3-shadow-stack
> [4]: https://inbox.sourceware.org/libc-help/aEhKdITyiwpMu7TO@arm.com/
> 


More information about the Libc-alpha mailing list