Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3433740pxb; Mon, 16 Nov 2020 14:48:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwnbdbXT7u7itCPHfvwGyEj5SdIqbXkDoL69VG5FshOV7Up3qPAQJKF+yaDUAL/qxtkoxa X-Received: by 2002:a17:906:3641:: with SMTP id r1mr17354401ejb.391.1605566890163; Mon, 16 Nov 2020 14:48:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605566890; cv=none; d=google.com; s=arc-20160816; b=miaujXvmlAYmBkZZ0AxdK5kVIL/Nvd16T/O3IxoxD2X8SQyTcvj6AkqFONpbSbHCN1 aiVK4qb9yg8+129+0xnBdp+a9mtcov0o2Zr+WqqlicNNWKpPdCsBjnvWmBSphjnWXmev Q9151Ic0Ssp1ruJkvx9m2kChBx2hFwMcU5JsrWxZp9YzulizVgfAaIYUNQU6GXppxT1f jDy358sV63gyo6Eya7N+bw/wr0XlQChj/vX1Yw9JHhxSA6XDAF1t/f+vnOmHAa/yoo8i 2yzAYRWkWz9IaY/B4MIUBQ2QQ6dgWbutHlZYxp0aSs6AoQNkQTCzzqjqm+C4ZQBVjXJw R+ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=/IJkmjOb+Ort2DqlyBwVKVb8n3j/fB7rR5InM7yLooU=; b=J/mCN1DxMixOukYcQcfcvgZtvVT5aPw90wxSqnhApKarwZC8r33x+ccSX25ykugWeO PRZOAzTQ4WyJ6aYFWdiLMeWd7Zhf+CMdIfB/6VTDvx4qx06cdecKjcDIFBY40f/f7PJj 5Nm4MbSldM40iLdTnq24bb8wzypkKRcYvpguqpHyN3YurKgzC8mlQrbnXbtSEwcflfBe 9bUnY1AVoK2bPkN5H8oKmjD5pKuXHX01nAbh9S49AOqqCBIKbeAtOo0kMZXRZxkbACHk kLTnswcttD36kTpiOZR3cbWudNSctOLCq11NH5k+b1YQlCJWvy4XAJj0QGTnafN2jgch w7GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=gZ7Waexf; dkim=neutral (no key) header.i=@linutronix.de header.b=Hqbc69kC; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si320344edl.577.2020.11.16.14.47.46; Mon, 16 Nov 2020 14:48:10 -0800 (PST) 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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=gZ7Waexf; dkim=neutral (no key) header.i=@linutronix.de header.b=Hqbc69kC; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732548AbgKPVLf (ORCPT + 99 others); Mon, 16 Nov 2020 16:11:35 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:43744 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728877AbgKPVLd (ORCPT ); Mon, 16 Nov 2020 16:11:33 -0500 Date: Mon, 16 Nov 2020 21:11:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1605561090; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/IJkmjOb+Ort2DqlyBwVKVb8n3j/fB7rR5InM7yLooU=; b=gZ7Waexf6MICDEcKQFve/U3U2vAKB0TxP6qY1nezkk1IM9Uef//36l6YAxczy0Y3i+lQdp kiv+okh/AAjfZFRL+imPUSQDpENG/aFcf4OIa0JoD2lo5e4EJ0fQCeAMtQElpOILhPCDl/ 81dV0Tn/TPNHczG33Q8wQrE7NbTgbLhxbDK0cXzlUWbR6OwbyxPNdC/bmQRUdEvrxCrW7a 6oBLGi97ZYD9J7P7NMDX4oDrDry85nxaKFOEE6+zPEp9QwvKXAhyq0Zwj6YjaN5Vz1R/yg 61IqrKn0nnSZVR/rSTz+A0eCnqfNQwXEA3cUwNxuvE9KICA/FGfp5CpnETTOsA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1605561090; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/IJkmjOb+Ort2DqlyBwVKVb8n3j/fB7rR5InM7yLooU=; b=Hqbc69kCPLjRLgwi9ggcrb1zGffH++6+X7Tbau3YgMc9YLYrTmc6q8jU5ZJFNT+RZIq12p bzYB8927asrQn1Ag== From: "tip-bot2 for Gabriel Krisman Bertazi" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: core/entry] entry: Drop usage of TIF flags in the generic syscall code Cc: Gabriel Krisman Bertazi , Thomas Gleixner , Andy Lutomirski , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20201116174206.2639648-10-krisman@collabora.com> References: <20201116174206.2639648-10-krisman@collabora.com> MIME-Version: 1.0 Message-ID: <160556108956.11244.6109673820343585025.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the core/entry branch of tip: Commit-ID: 2991552447707d791d9d81a5dc161f9e9e90b163 Gitweb: https://git.kernel.org/tip/2991552447707d791d9d81a5dc161f9e9e90b163 Author: Gabriel Krisman Bertazi AuthorDate: Mon, 16 Nov 2020 12:42:05 -05:00 Committer: Thomas Gleixner CommitterDate: Mon, 16 Nov 2020 21:53:16 +01:00 entry: Drop usage of TIF flags in the generic syscall code Now that the flags migration in the common syscall entry code is complete and the code relies exclusively on thread_info::syscall_work, clean up the accesses to TI flags in that path. Signed-off-by: Gabriel Krisman Bertazi Signed-off-by: Thomas Gleixner Reviewed-by: Andy Lutomirski Link: https://lore.kernel.org/r/20201116174206.2639648-10-krisman@collabora.com --- include/linux/entry-common.h | 26 ++++++++++++-------------- kernel/entry/common.c | 17 +++++++---------- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h index d7b96f4..49b26b2 100644 --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -26,31 +26,29 @@ #endif /* - * TIF flags handled in syscall_enter_from_user_mode() + * SYSCALL_WORK flags handled in syscall_enter_from_user_mode() */ -#ifndef ARCH_SYSCALL_ENTER_WORK -# define ARCH_SYSCALL_ENTER_WORK (0) +#ifndef ARCH_SYSCALL_WORK_ENTER +# define ARCH_SYSCALL_WORK_ENTER (0) #endif -#define SYSCALL_ENTER_WORK ARCH_SYSCALL_ENTER_WORK - /* - * TIF flags handled in syscall_exit_to_user_mode() + * SYSCALL_WORK flags handled in syscall_exit_to_user_mode() */ -#ifndef ARCH_SYSCALL_EXIT_WORK -# define ARCH_SYSCALL_EXIT_WORK (0) +#ifndef ARCH_SYSCALL_WORK_EXIT +# define ARCH_SYSCALL_WORK_EXIT (0) #endif -#define SYSCALL_EXIT_WORK ARCH_SYSCALL_EXIT_WORK - #define SYSCALL_WORK_ENTER (SYSCALL_WORK_SECCOMP | \ SYSCALL_WORK_SYSCALL_TRACEPOINT | \ SYSCALL_WORK_SYSCALL_TRACE | \ SYSCALL_WORK_SYSCALL_EMU | \ - SYSCALL_WORK_SYSCALL_AUDIT) + SYSCALL_WORK_SYSCALL_AUDIT | \ + ARCH_SYSCALL_WORK_ENTER) #define SYSCALL_WORK_EXIT (SYSCALL_WORK_SYSCALL_TRACEPOINT | \ SYSCALL_WORK_SYSCALL_TRACE | \ - SYSCALL_WORK_SYSCALL_AUDIT) + SYSCALL_WORK_SYSCALL_AUDIT | \ + ARCH_SYSCALL_WORK_EXIT) /* * TIF flags handled in exit_to_user_mode_loop() @@ -136,8 +134,8 @@ void syscall_enter_from_user_mode_prepare(struct pt_regs *regs); * * It handles the following work items: * - * 1) TIF flag dependent invocations of arch_syscall_enter_tracehook(), - * __secure_computing(), trace_sys_enter() + * 1) syscall_work flag dependent invocations of + * arch_syscall_enter_tracehook(), __secure_computing(), trace_sys_enter() * 2) Invocation of audit_syscall_entry() */ long syscall_enter_from_user_mode_work(struct pt_regs *regs, long syscall); diff --git a/kernel/entry/common.c b/kernel/entry/common.c index 90533f3..91e8fd5 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -42,7 +42,7 @@ static inline void syscall_enter_audit(struct pt_regs *regs, long syscall) } static long syscall_trace_enter(struct pt_regs *regs, long syscall, - unsigned long ti_work, unsigned long work) + unsigned long work) { long ret = 0; @@ -75,11 +75,9 @@ static __always_inline long __syscall_enter_from_user_work(struct pt_regs *regs, long syscall) { unsigned long work = READ_ONCE(current_thread_info()->syscall_work); - unsigned long ti_work; - ti_work = READ_ONCE(current_thread_info()->flags); - if (work & SYSCALL_WORK_ENTER || ti_work & SYSCALL_ENTER_WORK) - syscall = syscall_trace_enter(regs, syscall, ti_work, work); + if (work & SYSCALL_WORK_ENTER) + syscall = syscall_trace_enter(regs, syscall, work); return syscall; } @@ -227,8 +225,8 @@ static inline bool report_single_step(unsigned long work) } #endif -static void syscall_exit_work(struct pt_regs *regs, unsigned long ti_work, - unsigned long work) + +static void syscall_exit_work(struct pt_regs *regs, unsigned long work) { bool step; @@ -249,7 +247,6 @@ static void syscall_exit_work(struct pt_regs *regs, unsigned long ti_work, static void syscall_exit_to_user_mode_prepare(struct pt_regs *regs) { unsigned long work = READ_ONCE(current_thread_info()->syscall_work); - u32 cached_flags = READ_ONCE(current_thread_info()->flags); unsigned long nr = syscall_get_nr(current, regs); CT_WARN_ON(ct_state() != CONTEXT_KERNEL); @@ -266,8 +263,8 @@ static void syscall_exit_to_user_mode_prepare(struct pt_regs *regs) * enabled, we want to run them exactly once per syscall exit with * interrupts enabled. */ - if (unlikely(work & SYSCALL_WORK_EXIT || cached_flags & SYSCALL_EXIT_WORK)) - syscall_exit_work(regs, cached_flags, work); + if (unlikely(work & SYSCALL_WORK_EXIT)) + syscall_exit_work(regs, work); } __visible noinstr void syscall_exit_to_user_mode(struct pt_regs *regs)