linux-kernel.vger.kernel.org archive mirror
 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, linuxppc-dev@lists.ozlabs.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>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@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>
Subject: [PATCH v2 1/6] ptrace: move clearing of TIF_SYSCALL_EMU flag to core
Date: Mon, 18 Mar 2019 10:49:20 +0000	[thread overview]
Message-ID: <20190318104925.16600-2-sudeep.holla@arm.com> (raw)
In-Reply-To: <20190318104925.16600-1-sudeep.holla@arm.com>

While the TIF_SYSCALL_EMU is set in ptrace_resume independent of any
architecture, currently only powerpc and x86 unset the TIF_SYSCALL_EMU
flag in ptrace_disable which gets called from ptrace_detach.

Let's move the clearing of TIF_SYSCALL_EMU flag to ptrace_detach after
we return from ptrace_disable to ensure there's no change in the flow.

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 arch/powerpc/kernel/ptrace.c | 1 -
 arch/x86/kernel/ptrace.c     | 3 ---
 kernel/ptrace.c              | 4 ++++
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index d9ac7d94656e..2e2183b800a8 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -2520,7 +2520,6 @@ void ptrace_disable(struct task_struct *child)
 {
 	/* make sure the single step bit is not set. */
 	user_disable_single_step(child);
-	clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
 }
 
 #ifdef CONFIG_PPC_ADV_DEBUG_REGS
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 4b8ee05dd6ad..45792dbd2443 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -746,9 +746,6 @@ static int ioperm_get(struct task_struct *target,
 void ptrace_disable(struct task_struct *child)
 {
 	user_disable_single_step(child);
-#ifdef TIF_SYSCALL_EMU
-	clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
-#endif
 }
 
 #if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index 771e93f9c43f..4fa3b7f4c3c7 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -534,6 +534,10 @@ static int ptrace_detach(struct task_struct *child, unsigned int data)
 	/* Architecture-specific hardware disable .. */
 	ptrace_disable(child);
 
+#ifdef TIF_SYSCALL_EMU
+	clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
+#endif
+
 	write_lock_irq(&tasklist_lock);
 	/*
 	 * We rely on ptrace_freeze_traced(). It can't be killed and
-- 
2.17.1


  reply	other threads:[~2019-03-18 10:49 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-18 10:49 [PATCH v2 0/6] ptrace: consolidate PTRACE_SYSEMU handling and add support for arm64 Sudeep Holla
2019-03-18 10:49 ` Sudeep Holla [this message]
2019-03-18 17:29   ` [PATCH v2 1/6] ptrace: move clearing of TIF_SYSCALL_EMU flag to core Oleg Nesterov
2019-03-18 10:49 ` [PATCH v2 2/6] ptrace: introduce ptrace_syscall_enter to consolidate PTRACE_SYSEMU handling Sudeep Holla
2019-03-18 14:31   ` Dmitry V. Levin
2019-03-18 14:55     ` Sudeep Holla
2019-03-18 14:41   ` Dmitry V. Levin
2019-03-18 14:57     ` Sudeep Holla
2019-03-18 10:49 ` [PATCH v2 3/6] x86: clean up _TIF_SYSCALL_EMU handling using ptrace_syscall_enter hook Sudeep Holla
2019-03-18 15:33   ` Oleg Nesterov
2019-04-30 16:44     ` Sudeep Holla
2019-05-01 15:57       ` Oleg Nesterov
2019-05-01 16:51         ` Sudeep Holla
2019-04-30 16:46   ` Andy Lutomirski
2019-04-30 17:09     ` Sudeep Holla
2019-03-18 10:49 ` [PATCH v2 4/6] powerpc: use common ptrace_syscall_enter hook to handle _TIF_SYSCALL_EMU Sudeep Holla
2019-03-18 14:26   ` Dmitry V. Levin
2019-03-18 14:59     ` Sudeep Holla
2019-03-18 17:20   ` Oleg Nesterov
2019-03-18 17:24     ` Sudeep Holla
2019-03-18 17:33       ` Oleg Nesterov
2019-03-18 17:40         ` Sudeep Holla
2019-03-19 17:08           ` Oleg Nesterov
2019-03-19 17:32             ` Oleg Nesterov
2019-04-03 16:50               ` Will Deacon
2019-03-18 10:49 ` [PATCH v2 5/6] arm64: add PTRACE_SYSEMU{,SINGLESTEP} definations to uapi headers Sudeep Holla
2019-03-18 10:49 ` [PATCH v2 6/6] arm64: ptrace: add support for syscall emulation Sudeep Holla
2019-03-19  3:26   ` Haibo Xu (Arm Technology China)
2019-03-18 20:04 ` [PATCH v2 0/6] ptrace: consolidate PTRACE_SYSEMU handling and add support for arm64 Andy Lutomirski

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=20190318104925.16600-2-sudeep.holla@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=Steve.Capper@arm.com \
    --cc=bin.lu@arm.com \
    --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=linuxppc-dev@lists.ozlabs.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=oleg@redhat.com \
    --cc=paulus@samba.org \
    --cc=richard@nod.at \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    --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;
as well as URLs for NNTP newsgroup(s).