Message ID | 20190318104925.16600-2-sudeep.holla@arm.com (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | ptrace: consolidate PTRACE_SYSEMU handling and add support for arm64 | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch next (de3c83c2fd2b87cf68214eda76dfa66989d78cb6) |
snowpatch_ozlabs/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 26 lines checked |
On 03/18, Sudeep Holla wrote: > @@ -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 perhaps it makes sense to factor out clear_tsk_thread_flag(TIF_SYSCALL_EMU), but then we should probably clear it along with TIF_SYSCALL_TRACE in __ptrace_unlink? Oleg.
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
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(-)