[RFC PATCH v3 6/8] arm64: Add a compat syscall flag to thread_info

David Laight David.Laight at ACULAB.COM
Thu Apr 22 09:37:41 BST 2021


From: Amanieu d'Antras
> Sent: 21 April 2021 20:02
> 
> This flag is used by in_compat_syscall to handle compat syscalls coming
> from 64-bit tasks.
> 
> Signed-off-by: Amanieu d'Antras <amanieu at gmail.com>
> Co-developed-by: Ryan Houdek <Houdek.Ryan at fex-emu.org>
> Signed-off-by: Ryan Houdek <Houdek.Ryan at fex-emu.org>
> ---
>  arch/arm64/include/asm/compat.h      |  5 +++--
>  arch/arm64/include/asm/elf.h         | 13 ++++++++++++-
>  arch/arm64/include/asm/thread_info.h |  3 +++
>  3 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h
> index a2f5001f7793..71de0ba8b160 100644
> --- a/arch/arm64/include/asm/compat.h
> +++ b/arch/arm64/include/asm/compat.h
> @@ -190,13 +190,14 @@ static inline bool is_compat_thread(struct thread_info *thread)
> 
>  static inline bool in_compat_syscall(void)
>  {
> -	return is_compat_task();
> +	return is_compat_task() ||
> +		current_thread_info()->aarch64_compat_syscall;
>  }
...

Wouldn't it be better to ensure that a 'compat_task'
always has aarch64_compat_syscall set.

If you can't do that, just replacing the '||' with '|'
will generate better code for the usual case of both
flags being clear.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)




More information about the linux-arm-kernel mailing list