Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp581946ybg; Tue, 28 Jul 2020 13:23:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxGiZzkHYbvbEsoy3FOvnBELgHOQgXJ/17xyVFFfdwVTjQX7IQ1ZaPl+DYDw9tKyHVN5KS X-Received: by 2002:aa7:c84b:: with SMTP id g11mr2568021edt.292.1595967837679; Tue, 28 Jul 2020 13:23:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595967837; cv=none; d=google.com; s=arc-20160816; b=0ko2lJJWK7cguYjexxAaQxhX5/3G1oyxuXVHzoxG/02p66CvCoEk+yAc5JcBAHN8Y3 LQ/rQU3kcl8Z46LKAJ7mgQyv32NUWMhMsB421DVaUrb8nMEQE/9adUoCFgmkxSZZgN6m oqELzvK1f4qbhBAvPaJ5ly/XxNg9XeWvhw3x/1I8Ws7CLBP/yvAzLp2m4ugv7GT6s1z8 ZCd2W3EaRR8FjQAd2nUg8DrSMIDIxrXsPsh/+L/1bfA/xupgxNoPw6Yc7HrUnV+NQ67B IhHwM6IqW8qTNZ1Tpe0nCDrg0fusXOs+mdQZVMlzVHBePgWkZQ7J82dGXsXVTo+XbhRG XfRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Z3BvlfyDZg/8jAyXJZUoO3MmX0q3oH0h2M3gLGVUgSY=; b=WIws9IWhxGBTLrKuUe88UWh/Ij65CJ4w2x5e03UFf4m2LpqB/iYWNSUxbjTjoz0kGO HFl8K0jff21EE3JT6LLajwKixIw+Qm/ln1DoV+NZNphR22EyC7JGBLiSGa16C499fYTy nJr2CMt9GySkj/NvjVmG+LlIxS1iCYTZqmasqrzhemU3MFKZ+MNoo4wgRaHyxqIsNdWG 5SH5R2ZXIPhPmA2hXSSzWBq4eMNDmsStVZUA1hyUf7MJx+ROxi+WKDuRwuTFukBlcYRx LJK324QBpCysXERzXqegO8afQ/n1HCOFgc8pUuUHxrdI2jGFzhUQX9KDlLb43LAGYmMP aG4Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p6si4657107edx.443.2020.07.28.13.23.35; Tue, 28 Jul 2020 13:23:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728849AbgG1UW5 (ORCPT + 99 others); Tue, 28 Jul 2020 16:22:57 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:56844 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728817AbgG1UWz (ORCPT ); Tue, 28 Jul 2020 16:22:55 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: krisman) with ESMTPSA id 207DC291A2E From: Gabriel Krisman Bertazi To: luto@kernel.org, tglx@linutronix.de Cc: keescook@chromium.org, x86@kernel.org, linux-kernel@vger.kernel.org, Gabriel Krisman Bertazi , kernel@collabora.com Subject: [PATCH 3/6] arch: x86: Wrap TIF_X32 checks Date: Tue, 28 Jul 2020 16:22:26 -0400 Message-Id: <20200728202229.1195682-4-krisman@collabora.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200728202229.1195682-1-krisman@collabora.com> References: <20200728202229.1195682-1-krisman@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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