In preparation to remove TIF_X32, add a wrapper that checks the process
is using the X32 ABI without using the flag directly.

Signed-off-by: Gabriel Krisman Bertazi <kris...@collabora.com>
---
 arch/x86/entry/vdso/vma.c          | 2 +-
 arch/x86/include/asm/elf.h         | 2 +-
 arch/x86/include/asm/thread_info.h | 1 +
 arch/x86/kernel/process_64.c       | 3 +--
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c
index ea7c1f0b79df..0f54a5feeced 100644
--- a/arch/x86/entry/vdso/vma.c
+++ b/arch/x86/entry/vdso/vma.c
@@ -417,7 +417,7 @@ int compat_arch_setup_additional_pages(struct linux_binprm 
*bprm,
                                       int uses_interp)
 {
 #ifdef CONFIG_X86_X32_ABI
-       if (test_thread_flag(TIF_X32)) {
+       if (TASK_X32(current)) {
                if (!vdso64_enabled)
                        return 0;
                return map_vdso_randomized(&vdso_image_x32);
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 452beed7892b..a5c8f10d5180 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -363,7 +363,7 @@ do {                                                        
                \
 #define AT_SYSINFO             32
 
 #define COMPAT_ARCH_DLINFO                                             \
-if (test_thread_flag(TIF_X32))                                         \
+if (TASK_X32(current))                                                 \
        ARCH_DLINFO_X32;                                                \
 else                                                                   \
        ARCH_DLINFO_IA32
diff --git a/arch/x86/include/asm/thread_info.h 
b/arch/x86/include/asm/thread_info.h
index a3859595847c..6d55a9c0dda2 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -244,5 +244,6 @@ extern void arch_setup_new_exec(void);
 #endif /* !__ASSEMBLY__ */
 
 #define TASK_IA32(tsk) test_tsk_thread_flag(tsk, TIF_IA32)
+#define TASK_X32(tsk) test_tsk_thread_flag(tsk, TIF_X32)
 
 #endif /* _ASM_X86_THREAD_INFO_H */
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 4452a35402f9..f20a365017b8 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -406,8 +406,7 @@ EXPORT_SYMBOL_GPL(start_thread);
 void compat_start_thread(struct pt_regs *regs, u32 new_ip, u32 new_sp)
 {
        start_thread_common(regs, new_ip, new_sp,
-                           test_thread_flag(TIF_X32)
-                           ? __USER_CS : __USER32_CS,
+                           TASK_X32(current) ? __USER_CS : __USER32_CS,
                            __USER_DS, __USER_DS);
 }
 #endif
-- 
2.27.0

Reply via email to