Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Pu Hu <hupu@transsion.com>
Cc: Hongyan Xia <hongyan.xia@transsion.com>,
	Jiazi Li <jiazi.li@transsion.com>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"naveen@kernel.org" <naveen@kernel.org>,
	"yang@os.amperecomputing.com" <yang@os.amperecomputing.com>,
	"will@kernel.org" <will@kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-trace-kernel@vger.kernel.org"
	<linux-trace-kernel@vger.kernel.org>
Subject: Re: [RFC 0/3] arm64: kprobes: Fix single-step fault and reentry handling
Date: Wed, 8 Jul 2026 09:55:40 +0900	[thread overview]
Message-ID: <20260708095540.31c97fcbe9a56f3fd7f0b284@kernel.org> (raw)
In-Reply-To: <20260706083636.159883-1-hupu@transsion.com>

Hi, Pu,

Thanks for updating the series. But even if it just update
the signed-off-by, please update the version.

Also, can you check the Sashiko's comments?

https://sashiko.dev/#/patchset/20260706083636.159883-1-hupu%40transsion.com

Thank you,

On Mon, 6 Jul 2026 08:36:46 +0000
Pu Hu <hupu@transsion.com> wrote:

> From: Pu Hu <hupu@transsion.com>
> 
> This series fixes two arm64 kprobes issues observed when running
> simpleperf with preemptirq tracepoints and dwarf callchains while a
> kprobe is active on a frequently executed kernel function.
> 
> The crash happens in the kprobe debug exception path. While a kprobe is
> preparing or executing its XOL single-step instruction, perf/trace code
> can run in the same window. That code may either take a fault of its own
> or hit another kprobe.
> 
> Patch 1 makes kprobe_fault_handler() handle a fault in
> KPROBE_HIT_SS/KPROBE_REENTER only when the faulting PC points at the
> current kprobe's XOL instruction. Otherwise the fault is left to the
> normal fault handling path.
> 
> Patch 2 allows a kprobe hit in KPROBE_HIT_SS to be handled as a
> recoverable one-level reentry. Only a hit while already in
> KPROBE_REENTER remains unrecoverable.
> 
> Patch 3 adds a kprobes selftest which registers a kprobe on a frequently
> executed filemap fault path and drives repeated file-backed page faults
> from userspace. This provides a smaller reproducer for validating the
> fault handling fix.
> 
> This follows the same logic as the existing x86 fixes:
>   6381c24cd6d5 ("kprobes/x86: Fix page-fault handling logic")
>   6a5022a56ac3 ("kprobes/x86: Allow to handle reentered kprobe on single-stepping")
> 
> Reproducer:
> 
>   simpleperf record -p <pid> -f 10000 \
>     -e preemptirq:preempt_disable \
>     -e preemptirq:preempt_enable \
>     --duration 9 --call-graph dwarf \
>     -o /data/local/tmp/perf.data
> 
> The new selftest can be built from tools/testing/selftests/kprobe/ and
> used to exercise the page fault handling path with the test kprobe
> module loaded.
> 
> Before this series, the crash reproduced frequently. With both patches
> applied, it was no longer reproduced in our testing.
> 
> 
> Pu Hu (3):
>   arm64: kprobes: Do not handle non-XOL faults as kprobe faults
>   arm64: kprobes: Allow reentering kprobes while single-stepping
>   selftests/kprobes: Add kprobe stress test for page fault handling
> 
>  arch/arm64/kernel/probes/kprobes.c            |  22 +++-
>  tools/testing/selftests/kprobe/.gitignore     |   2 +
>  tools/testing/selftests/kprobe/Makefile       |  75 +++++++++++++
>  tools/testing/selftests/kprobe/fault_stress.c | 105 ++++++++++++++++++
>  .../selftests/kprobe/kprobe_folio_stress.c    |  70 ++++++++++++
>  5 files changed, 273 insertions(+), 1 deletion(-)
>  create mode 100644 tools/testing/selftests/kprobe/.gitignore
>  create mode 100644 tools/testing/selftests/kprobe/Makefile
>  create mode 100644 tools/testing/selftests/kprobe/fault_stress.c
>  create mode 100644 tools/testing/selftests/kprobe/kprobe_folio_stress.c
> 
> -- 
> 2.43.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>


      parent reply	other threads:[~2026-07-08  0:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 12:14 [RFC 0/2] arm64: kprobes: Fix single-step fault and reentry handling Pu Hu
2026-07-01 12:30 ` Pu Hu
2026-07-01 13:43 ` Masami Hiramatsu
2026-07-01 13:56   ` Pu Hu
2026-07-02 10:07     ` Pu Hu
2026-07-02 10:09       ` Pu Hu
2026-07-04 14:47         ` Masami Hiramatsu
     [not found]           ` <20260706083636.159883-1-hupu@transsion.com>
     [not found]             ` <20260706083636.159883-2-hupu@transsion.com>
2026-07-08  0:46               ` [RFC 1/3] arm64: kprobes: Do not handle non-XOL faults as kprobe faults Masami Hiramatsu
2026-07-08  5:57                 ` Hongyan Xia
2026-07-08  7:42                   ` Masami Hiramatsu
2026-07-08  8:55                     ` Hongyan Xia
     [not found]             ` <20260706083636.159883-3-hupu@transsion.com>
2026-07-08  0:54               ` [RFC 2/3] arm64: kprobes: Allow reentering kprobes while single-stepping Masami Hiramatsu
2026-07-08  7:12                 ` Hongyan Xia
2026-07-08  0:55             ` Masami Hiramatsu [this message]

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=20260708095540.31c97fcbe9a56f3fd7f0b284@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=davem@davemloft.net \
    --cc=hongyan.xia@transsion.com \
    --cc=hupu@transsion.com \
    --cc=jiazi.li@transsion.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=naveen@kernel.org \
    --cc=will@kernel.org \
    --cc=yang@os.amperecomputing.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