ptrace: move clearing of TIF_SYSCALL_EMU flag to core
authorSudeep Holla <sudeep.holla@arm.com>
Thu, 23 May 2019 09:06:15 +0000 (10:06 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 5 Jun 2019 16:51:17 +0000 (17:51 +0100)
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_unlink
which gets executed from ptrace_detach and also keep it along with
or close to clearing of TIF_SYSCALL_TRACE.

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>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/powerpc/kernel/ptrace.c
arch/x86/kernel/ptrace.c
kernel/ptrace.c

index 684b0b315c327a44c2eb34493c43e3c3494e437c..8c92febf5f443955eaf84fd9278a3ba4429f22ec 100644 (file)
@@ -2521,7 +2521,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
index a166c960bc9e394be2e2f1be0463cf239d18757c..36998e0c3fc44fcfb1219b06390f7be953fe336d 100644 (file)
@@ -747,9 +747,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
index 5710d07e67cf7f0f94342b0194939d479871b821..ab14654b24367a06fa150e35b21cb99e56fb348a 100644 (file)
@@ -118,6 +118,9 @@ void __ptrace_unlink(struct task_struct *child)
        BUG_ON(!child->ptrace);
 
        clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
+#ifdef TIF_SYSCALL_EMU
+       clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
+#endif
 
        child->parent = child->real_parent;
        list_del_init(&child->ptrace_entry);