LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: x86@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: Sudeep Holla <sudeep.holla@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Richard Weinberger <richard@nod.at>,
	jdike@addtoit.com, Steve Capper <Steve.Capper@arm.com>,
	Haibo Xu <haibo.xu@arm.com>, Bin Lu <bin.lu@arm.com>,
	Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>
Subject: [PATCH v4 2/4] x86: simplify _TIF_SYSCALL_EMU handling
Date: Thu, 23 May 2019 10:06:16 +0100	[thread overview]
Message-ID: <20190523090618.13410-3-sudeep.holla@arm.com> (raw)
In-Reply-To: <20190523090618.13410-1-sudeep.holla@arm.com>

The usage of emulated/_TIF_SYSCALL_EMU flags in syscall_trace_enter
seems to be bit overcomplicated than required. Let's simplify it.

Cc: Andy Lutomirski <luto@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 arch/x86/entry/common.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index a986b3c8294c..0a61705d62ec 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -72,23 +72,18 @@ static long syscall_trace_enter(struct pt_regs *regs)
 
 	struct thread_info *ti = current_thread_info();
 	unsigned long ret = 0;
-	bool emulated = false;
 	u32 work;
 
 	if (IS_ENABLED(CONFIG_DEBUG_ENTRY))
 		BUG_ON(regs != task_pt_regs(current));
 
-	work = READ_ONCE(ti->flags) & _TIF_WORK_SYSCALL_ENTRY;
+	work = READ_ONCE(ti->flags);
 
-	if (unlikely(work & _TIF_SYSCALL_EMU))
-		emulated = true;
-
-	if ((emulated || (work & _TIF_SYSCALL_TRACE)) &&
-	    tracehook_report_syscall_entry(regs))
-		return -1L;
-
-	if (emulated)
-		return -1L;
+	if (work & (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU)) {
+		ret = tracehook_report_syscall_entry(regs);
+		if (ret || (work & _TIF_SYSCALL_EMU))
+			return -1L;
+	}
 
 #ifdef CONFIG_SECCOMP
 	/*
-- 
2.17.1


  parent reply	other threads:[~2019-05-23  9:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-23  9:06 [PATCH v4 0/4] ptrace: cleanup PTRACE_SYSEMU handling and add support for arm64 Sudeep Holla
2019-05-23  9:06 ` [PATCH v4 1/4] ptrace: move clearing of TIF_SYSCALL_EMU flag to core Sudeep Holla
2019-05-23  9:06 ` Sudeep Holla [this message]
2019-06-03 17:22   ` [PATCH v4 2/4] x86: simplify _TIF_SYSCALL_EMU handling Catalin Marinas
2019-06-11 14:38   ` Thomas Gleixner
2019-06-11 14:56   ` [PATCH v5 2/4] x86/entry: Simplify " Sudeep Holla
2019-06-24 17:30     ` Catalin Marinas
2019-06-24 17:37       ` Thomas Gleixner
2019-06-26 18:45         ` Thomas Gleixner
2019-05-23  9:06 ` [PATCH v4 3/4] arm64: add PTRACE_SYSEMU{,SINGLESTEP} definations to uapi headers Sudeep Holla
2019-05-23  9:06 ` [PATCH v4 4/4] arm64: ptrace: add support for syscall emulation Sudeep Holla
2019-06-05 16:54 ` [PATCH v4 0/4] ptrace: cleanup PTRACE_SYSEMU handling and add support for arm64 Catalin Marinas

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=20190523090618.13410-3-sudeep.holla@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=Steve.Capper@arm.com \
    --cc=bin.lu@arm.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=haibo.xu@arm.com \
    --cc=jdike@addtoit.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=richard@nod.at \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH v4 2/4] x86: simplify _TIF_SYSCALL_EMU handling' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).