mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Gabriel Krisman Bertazi" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Gabriel Krisman Bertazi <krisman@collabora.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andy Lutomirski <luto@kernel.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: core/entry] entry: Drop usage of TIF flags in the generic syscall code
Date: Mon, 16 Nov 2020 21:11:29 -0000	[thread overview]
Message-ID: <160556108956.11244.6109673820343585025.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20201116174206.2639648-10-krisman@collabora.com>

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 <krisman@collabora.com>
AuthorDate:    Mon, 16 Nov 2020 12:42:05 -05:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
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 <krisman@collabora.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Andy Lutomirski <luto@kernel.org>
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)

  reply	other threads:[~2020-11-16 21:12 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16 17:41 [PATCH v2 00/10] Migrate syscall entry/exit work to SYSCALL_WORK flagset Gabriel Krisman Bertazi
2020-11-16 17:41 ` [PATCH v2 01/10] x86: Expose syscall_work field in thread_info Gabriel Krisman Bertazi
2020-11-16 21:11   ` [tip: core/entry] " tip-bot2 for Gabriel Krisman Bertazi
2020-11-16 17:41 ` [PATCH v2 02/10] entry: Expose helpers to migrate TIF to SYSCALL_WORK flags Gabriel Krisman Bertazi
2020-11-16 21:11   ` [tip: core/entry] " tip-bot2 for Gabriel Krisman Bertazi
2020-11-16 17:41 ` [PATCH v2 03/10] entry: Wire up syscall_work in common entry code Gabriel Krisman Bertazi
2020-11-16 21:11   ` [tip: core/entry] " tip-bot2 for Gabriel Krisman Bertazi
2020-11-16 17:42 ` [PATCH v2 04/10] seccomp: Migrate to use SYSCALL_WORK flag Gabriel Krisman Bertazi
2020-11-16 21:11   ` [tip: core/entry] " tip-bot2 for Gabriel Krisman Bertazi
2020-11-24 16:28   ` [PATCH v2 04/10] " Dmitry Osipenko
2020-11-24 17:55     ` Gabriel Krisman Bertazi
2020-11-24 18:41       ` Dmitry Osipenko
2020-11-16 17:42 ` [PATCH v2 05/10] tracepoints: " Gabriel Krisman Bertazi
2020-11-16 21:11   ` [tip: core/entry] " tip-bot2 for Gabriel Krisman Bertazi
2020-11-17 19:11   ` [PATCH v2 05/10] " Steven Rostedt
2020-11-16 17:42 ` [PATCH v2 06/10] ptrace: Migrate to use SYSCALL_TRACE flag Gabriel Krisman Bertazi
2020-11-16 21:11   ` [tip: core/entry] " tip-bot2 for Gabriel Krisman Bertazi
2020-11-16 17:42 ` [PATCH v2 07/10] ptrace: Migrate TIF_SYSCALL_EMU to use SYSCALL_WORK flag Gabriel Krisman Bertazi
2020-11-16 21:11   ` [tip: core/entry] " tip-bot2 for Gabriel Krisman Bertazi
2020-11-16 17:42 ` [PATCH v2 08/10] audit: Migrate " Gabriel Krisman Bertazi
2020-11-16 21:11   ` [tip: core/entry] " tip-bot2 for Gabriel Krisman Bertazi
2020-11-16 17:42 ` [PATCH v2 09/10] entry: Drop usage of TIF flags in the generic syscall code Gabriel Krisman Bertazi
2020-11-16 21:11   ` tip-bot2 for Gabriel Krisman Bertazi [this message]
2020-11-16 17:42 ` [PATCH v2 10/10] x86: Reclaim unused x86 TI flags Gabriel Krisman Bertazi
2020-11-16 21:11   ` [tip: core/entry] " tip-bot2 for 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=160556108956.11244.6109673820343585025.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=krisman@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@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

all inboxes | Powered by JetHome®