Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1284624

Re: [PATCH] ARM64: Clear out any singlestep state on a ptrace detach operation

From Oleg Nesterov <oleg@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] ARM64: Clear out any singlestep state on a ptrace detach operation
Date 2015-12-05 19:50 +0100
Message-ID <qCq49-4EM-3@gated-at.bofh.it> (permalink)
References <qBIwa-1o5-15@gated-at.bofh.it> <qBVto-1iR-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 12/04, Will Deacon wrote:
>
> I hacked up a quick patch below (not even compile-tested), but I'm not
> sure what to do about hardware {break,watch}points. Some architectures
> explicitly clear those on detach, whereas others appear to leave them
> alone. Thoughts?

Heh ;)

Please see fab840fc2d542fabcab "ptrace: PTRACE_DETACH should do
flush_ptrace_hw_breakpoint(child)".

And the next "revert" commit, 35114fcbe0b9b0fa3f6653a2.

> --- a/kernel/ptrace.c
> +++ b/kernel/ptrace.c
> @@ -454,13 +454,20 @@ static bool __ptrace_detach(struct task_struct *tracer, struct task_struct *p)
>  	return dead;
>  }
>
> +#ifndef arch_ptrace_detach
> +#define arch_ptrace_detach(child)	do { } while (0)
> +#endif
> +
>  static int ptrace_detach(struct task_struct *child, unsigned int data)
>  {
>  	if (!valid_signal(data))
>  		return -EIO;
>
> -	/* Architecture-specific hardware disable .. */
> -	ptrace_disable(child);
> +	arch_ptrace_detach(child);
> +	user_disable_single_step(child);
> +#ifdef TIF_SYSCALL_EMU
> +	clear_tsk_thread_flag(child, TIF_SYSCALL_EMU);
> +#endif
>  	clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);

Well, personally I'd prefer to keep the arch-dependent ptrace_disable(), this
just looks safer to me. Although I agree that its name is bad and
arch_ptrace_detach() looks much better.

Oleg.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] ARM64: Clear out any singlestep state on a ptrace detach  operation John Blackwood <john.blackwood@ccur.com> - 2015-12-03 21:20 +0100
  Re: [PATCH] ARM64: Clear out any singlestep state on a ptrace detach  operation Will Deacon <will.deacon@arm.com> - 2015-12-04 11:10 +0100
    Re: [PATCH] ARM64: Clear out any singlestep state on a ptrace  detach operation Oleg Nesterov <oleg@redhat.com> - 2015-12-05 19:50 +0100
      Re: [PATCH] ARM64: Clear out any singlestep state on a ptrace detach  operation Will Deacon <will.deacon@arm.com> - 2015-12-07 12:50 +0100

csiph-web