public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Blackwood <john.blackwood@ccur.com>
To: Will Deacon <will.deacon@arm.com>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH] ARM64: Clear out any singlestep state on a ptrace detach operation
Date: Thu, 3 Dec 2015 14:05:31 -0600	[thread overview]
Message-ID: <5660A08B.6030204@ccur.com> (raw)

Hello Will,

I have a patch for a ptrace(2) issue that we encountered on arm64 kernels.
If a debugger singlesteps a ptraced task, and then does a ptrace(2)
PTRACE_DETACH command, the task will not resume successfully. It seems
that clearing out the singlestep state, as something like a ptrace(2)
PTRACE_CONT does, gets this working.

Thank you for your time and considerations.

----- -----

arm64: Clear out any singlestep state on a ptrace detach operation.

Make sure to clear out any ptrace singlestep state when a
ptrace(2) PTRACE_DETACH call is made on arm64 systems.

Otherwise, the previously ptraced task will die off with a SIGTRAP signal
if the debugger just previously singlestepped the ptraced task.

Signed-off-by: John Blackwood <john.blackwood@ccur.com>

Index: b/arch/arm64/kernel/ptrace.c
===================================================================
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -58,6 +58,7 @@
   */
  void ptrace_disable(struct task_struct *child)
  {
+	user_disable_single_step(child);
  }
  
  #ifdef CONFIG_HAVE_HW_BREAKPOINT

             reply	other threads:[~2015-12-03 20:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03 20:05 John Blackwood [this message]
2015-12-04 10:03 ` [PATCH] ARM64: Clear out any singlestep state on a ptrace detach operation Will Deacon
2015-12-05 18:48   ` Oleg Nesterov
2015-12-07 11:47     ` Will Deacon
  -- strict thread matches above, loose matches on Subject: below --
2015-12-04 21:42 John Blackwood

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=5660A08B.6030204@ccur.com \
    --to=john.blackwood@ccur.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will.deacon@arm.com \
    /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