public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@collabora.com>
To: luto@kernel.org, tglx@linutronix.de
Cc: keescook@chromium.org, x86@kernel.org,
	linux-kernel@vger.kernel.org,
	Gabriel Krisman Bertazi <krisman@collabora.com>,
	kernel@collabora.com
Subject: [PATCH 3/6] arch: x86: Wrap TIF_X32 checks
Date: Tue, 28 Jul 2020 16:22:26 -0400	[thread overview]
Message-ID: <20200728202229.1195682-4-krisman@collabora.com> (raw)
In-Reply-To: <20200728202229.1195682-1-krisman@collabora.com>

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 <krisman@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


  parent reply	other threads:[~2020-07-28 20:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-28 20:22 [PATCH 0/6] Reclaim x86 psABI TIF flags Gabriel Krisman Bertazi
2020-07-28 20:22 ` [PATCH 1/6] arch: x86: Don't use TIF flags for mm context Gabriel Krisman Bertazi
2020-07-29  9:03   ` peterz
2020-07-28 20:22 ` [PATCH 2/6] arch: x86: Wrap TIF_IA32 checks Gabriel Krisman Bertazi
2020-07-29  3:43   ` Andy Lutomirski
2020-07-29  4:46     ` Gabriel Krisman Bertazi
2020-07-29  5:09       ` Andy Lutomirski
2020-07-29 18:11         ` Gabriel Krisman Bertazi
2020-07-29  6:59     ` Christoph Hellwig
2020-07-29  9:11     ` peterz
2020-07-28 20:22 ` Gabriel Krisman Bertazi [this message]
2020-07-29  4:54   ` [PATCH 3/6] arch: x86: Wrap TIF_X32 checks Andy Lutomirski
2020-07-28 20:22 ` [PATCH 4/6] arch: x86: Expose psABI on thread_info Gabriel Krisman Bertazi
2020-07-29  3:44   ` Andy Lutomirski
2020-07-28 20:22 ` [PATCH 5/6] arch: x86: Reclaim TIF_IA32 flag Gabriel Krisman Bertazi
2020-07-28 20:22 ` [PATCH 6/6] arch: x86: Reclaim TIF_X32 flag Gabriel Krisman Bertazi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200728202229.1195682-4-krisman@collabora.com \
    --to=krisman@collabora.com \
    --cc=keescook@chromium.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox