From: Will Deacon <will@kernel.org>
To: Keno Fischer <keno@juliacomputing.com>
Cc: Mark Rutland <mark.rutland@arm.com>,
Luis Machado <luis.machado@linaro.org>,
kernel-team@android.com, stable@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] arm64: Override SPSR.SS when single-stepping is enabled
Date: Wed, 3 Jun 2020 16:53:39 +0100 [thread overview]
Message-ID: <20200603155338.GA12036@willie-the-truck> (raw)
In-Reply-To: <CABV8kRwrnixNc074-jQhZzeucGHx9_e5FnQmBS=VuL=tFGjY-Q@mail.gmail.com>
Hi Keno,
Thanks for having a look.
On Wed, Jun 03, 2020 at 11:42:46AM -0400, Keno Fischer wrote:
> On Wed, Jun 3, 2020 at 11:10 AM Will Deacon <will@kernel.org> wrote:
> >
> > Luis reports that, when reverse debugging with GDB, single-step does not
> > function as expected on arm64:
> >
> > | I've noticed, under very specific conditions, that a PTRACE_SINGLESTEP
> > | request by GDB won't execute the underlying instruction. As a consequence,
> > | the PC doesn't move, but we return a SIGTRAP just like we would for a
> > | regular successful PTRACE_SINGLESTEP request.
> >
> > The underlying problem is that when the CPU register state is restored
> > as part of a reverse step, the SPSR.SS bit is cleared and so the hardware
> > single-step state can transition to the "active-pending" state, causing
> > an unexpected step exception to be taken immediately if a step operation
> > is attempted.
>
> We saw this issue also and worked around it in user-space [1]. That said,
> I think I'm ok with this change in the kernel, since I can't think of
> a particularly useful usecase for this feature.
>
> However, at the same time as changing this, we should probably make sure
> to enable the syscall exit pseudo-singlestep trap (similar issue as the other
> patch I had sent for the signal pseudo-singlestep trap), since otherwise
> ptracers might get confused about the lack of singlestep trap during a
> singlestep -> seccomp -> singlestep path (which would give one trap
> less with this patch than before).
Hmm, I don't completely follow your example. Please could you spell it
out a bit more? I fast-forward the stepping state machine on sigreturn,
which I thought would be sufficient. Perhaps you're referring to a variant
of the situation mentioned by Mark, which I didn't think could happen
with ptrace [2].
Cheers,
Will
[2] https://lore.kernel.org/r/20200531095216.GB30204@willie-the-truck
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-06-03 15:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-03 15:10 [PATCH 0/2] arm64: Fix single-stepping with reverse debugging Will Deacon
2020-06-03 15:10 ` [PATCH 1/2] arm64: Override SPSR.SS when single-stepping is enabled Will Deacon
2020-06-03 15:42 ` Keno Fischer
2020-06-03 15:53 ` Will Deacon [this message]
2020-06-03 16:56 ` Keno Fischer
2020-06-04 8:32 ` Will Deacon
2020-06-04 22:32 ` Keno Fischer
2020-06-05 4:50 ` Luis Machado
2020-06-05 20:12 ` Keno Fischer
2020-06-03 15:10 ` [PATCH 2/2] arm64: Use test_tsk_thread_flag() for checking TIF_SINGLESTEP Will Deacon
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=20200603155338.GA12036@willie-the-truck \
--to=will@kernel.org \
--cc=keno@juliacomputing.com \
--cc=kernel-team@android.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=luis.machado@linaro.org \
--cc=mark.rutland@arm.com \
--cc=stable@vger.kernel.org \
/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