Skip to content

Commit 15532fd

Browse files
sudeep-hollactmarinas
authored andcommitted
ptrace: move clearing of TIF_SYSCALL_EMU flag to core
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>
1 parent 6168103 commit 15532fd

3 files changed

Lines changed: 3 additions & 4 deletions

File tree

‎arch/powerpc/kernel/ptrace.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2521,7 +2521,6 @@ void ptrace_disable(struct task_struct *child)
25212521
{
25222522
/* make sure the single step bit is not set. */
25232523
user_disable_single_step(child);
2524-
clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
25252524
}
25262525

25272526
#ifdef CONFIG_PPC_ADV_DEBUG_REGS

‎arch/x86/kernel/ptrace.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -747,9 +747,6 @@ static int ioperm_get(struct task_struct *target,
747747
void ptrace_disable(struct task_struct *child)
748748
{
749749
user_disable_single_step(child);
750-
#ifdef TIF_SYSCALL_EMU
751-
clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
752-
#endif
753750
}
754751

755752
#if defined CONFIG_X86_32 || defined CONFIG_IA32_EMULATION

‎kernel/ptrace.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ void __ptrace_unlink(struct task_struct *child)
118118
BUG_ON(!child->ptrace);
119119

120120
clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
121+
#ifdef TIF_SYSCALL_EMU
122+
clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
123+
#endif
121124

122125
child->parent = child->real_parent;
123126
list_del_init(&child->ptrace_entry);

0 commit comments

Comments
 (0)