All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Jean-Philippe Brucker <jean-philippe@linaro.org>
Cc: catalin.marinas@arm.com, Will Deacon <will@kernel.org>,
	dianders@chromium.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] arm64: Fix early single-stepping
Date: Wed, 28 Oct 2020 21:21:45 +0900	[thread overview]
Message-ID: <20201028212145.e8fc44671c3193da076351e5@kernel.org> (raw)
In-Reply-To: <20201028094827.GC2328726@myrica>

On Wed, 28 Oct 2020 10:48:27 +0100
Jean-Philippe Brucker <jean-philippe@linaro.org> wrote:

> On Wed, Oct 28, 2020 at 06:07:31PM +0900, Masami Hiramatsu wrote:
> > > > Yes, I think so. Same order problem as the OS lock, they need to be reset
> > > > before enable_debug_monitors(). On CPU0 that would be before
> > > > early_initcall and for secondaries the hotplug notifier needs to be
> > > > installed earlier as well. I'll send a v2.
> > > 
> > > Cheers. An alternative (which I think would be better in the long run
> > > anyway) would be to avoid using hardware step in kprobes and instead rely
> > > on a BRK instruction to trap after running the trampoline.
> > 
> > But how we trap the instruction which can change pc? (like br?)
> > Are all those instruction emulated now?
> 
> According to aarch64_insn_is_steppable() anything that changes the PC is
> emulated.

OK, that sounds good. Then we can put the BRK right after the copied instruction.

> I'm also checking whether there is a change of behavior with
> synchronous exceptions taken while single-stepping (page faults).

Thanks! From the kprobe_fault_handler(), it seems the page faults handled
before the single-stepping exception and the fault handler disables single
steping explicitly. So if we use BRK, that code will not be needed.

Thank you,

-- 
Masami Hiramatsu <mhiramat@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-10-28 12:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-26 17:29 [PATCH] arm64: Fix early single-stepping Jean-Philippe Brucker
2020-10-26 17:38 ` Will Deacon
2020-10-27  0:48   ` Masami Hiramatsu
2020-10-27 10:13 ` Masami Hiramatsu
2020-10-27 10:42   ` Masami Hiramatsu
2020-10-27 11:59     ` Jean-Philippe Brucker
2020-10-27 12:33       ` Will Deacon
2020-10-27 13:49         ` Masami Hiramatsu
2020-10-28  8:28           ` Jean-Philippe Brucker
2020-10-28  8:36             ` Will Deacon
2020-10-28  9:07               ` Masami Hiramatsu
2020-10-28  9:48                 ` Jean-Philippe Brucker
2020-10-28 12:21                   ` Masami Hiramatsu [this message]
2020-11-25 16:09               ` Masami Hiramatsu
2020-11-25 16:11                 ` Will Deacon
2020-11-25 16:18                   ` Masami Hiramatsu

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=20201028212145.e8fc44671c3193da076351e5@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dianders@chromium.org \
    --cc=jean-philippe@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=will@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.