Similar to ("arch: add compat helpers specific to 32-bit"), add 64 bit variants to determine if we're in a COMPAT64 syscall.
Signed-off-by: Zachary Leaf zachary.leaf@arm.com --- arch/arm64/include/asm/compat.h | 5 +++++ include/linux/compat.h | 6 ++++++ 2 files changed, 11 insertions(+)
diff --git a/arch/arm64/include/asm/compat.h b/arch/arm64/include/asm/compat.h index 40cd9f48eb53..16a0a3ff78c9 100644 --- a/arch/arm64/include/asm/compat.h +++ b/arch/arm64/include/asm/compat.h @@ -112,6 +112,11 @@ static inline int is_32bit_compat_task(void) return IS_ENABLED(CONFIG_COMPAT32) && test_thread_flag(TIF_32BIT); }
+static inline bool is_64bit_compat_task(void) +{ + return IS_ENABLED(CONFIG_COMPAT64) && test_thread_flag(TIF_64BIT_COMPAT); +} + static inline int is_compat_task(void) { return (IS_ENABLED(CONFIG_COMPAT32) && test_thread_flag(TIF_32BIT)) || diff --git a/include/linux/compat.h b/include/linux/compat.h index f6979417c673..54dd8a8a16bc 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -1023,16 +1023,22 @@ static inline bool in_compat_syscall(void) { return is_compat_task(); } #ifndef in_compat32_syscall static inline bool in_compat32_syscall(void) { return is_32bit_compat_task(); } #endif +#ifndef in_compat64_syscall +static inline bool in_compat64_syscall(void) { return is_64bit_compat_task(); } +#endif
#else /* !CONFIG_COMPAT */
#define is_compat_task() (0) #define is_32bit_compat_task() (0) +#define is_64bit_compat_task() (0) /* Ensure no one redefines in_compat_syscall() under !CONFIG_COMPAT */ #define in_compat_syscall in_compat_syscall static inline bool in_compat_syscall(void) { return false; } #define in_compat32_syscall in_compat32_syscall static inline bool in_compat32_syscall(void) { return false; } +#define in_compat64_syscall in_compat64_syscall +static inline bool in_compat64_syscall(void) { return false; }
#endif /* CONFIG_COMPAT */