Linux Trace Kernel
 help / color / mirror / Atom feed
From: Stian Halseth <stian@itx.no>
To: "David S. Miller" <davem@davemloft.net>,
	Andreas Larsson <andreas@gaisler.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Naveen N Rao <naveen@kernel.org>,
	Danish Khateeb <danishkhateeb03@gmail.com>,
	sparclinux@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-kernel@vger.kernel.org, Stian Halseth <stian@itx.no>
Subject: [PATCH v2 0/4] sparc64: kprobes: Make kprobes work on sun4v
Date: Fri, 13 Nov 2026 15:40:53 +0100	[thread overview]
Message-ID: <20261113144057.1697874-1-stian@itx.no> (raw)

Any kprobe hit on a sun4v machine oopses. The probed instruction is
single-stepped from memory that is not executable there. Patch 1
moves the copy into an instruction slot from get_insn_slot(), as other
architectures do.

Once probes work, three older single-step bugs show up. A taken BPr or
FP branch resumes at the wrong address (patch 2). So does a probe on a
delay slot instruction (patch 3). An annulled branch can skip the
break instruction after the copy (patch 4). Patch 2 overlaps Danish
Khateeb's relbranch_fixup() fix from September. Whichever is applied
first, the other is a small rebase.

Tested on a SPARC T7-1 and T4-1 (sun4v) and a Sun Fire V240 (sun4u):
entry and return probes, probes on all 50 instructions of
__task_pid_nr_ns at once while checking getppid(), ps and /proc, probes
on the SPARC AES routines during AF_ALG encryption (sun4v), and
refusal of ba,a. Without the series the first probe hit oopses on
sun4v. A probe on a taken brnz oopses on sun4u as well.

v2: make flush_insn_slot() a no-op in patch 1 (Masami). The slot is
flushed in arch_prepare_kprobe() when it is written. A killed probe
has a NULL slot pointer. init_aggr_kprobe() flushed through it.
Patch 4 no longer touches the macro. Rebased onto 7.4-rc3. Build
tested on the T7-1.
v1: https://lore.kernel.org/all/20261009180336.1315684-1-stian@itx.no/

Stian Halseth (4):
  sparc64: kprobes: Single-step from an executable instruction slot
  sparc64: kprobes: Fix up register and FP branches after single-step
  sparc64: kprobes: Resume after a delay slot at the saved next PC
  sparc64: kprobes: Handle annulled branches

 arch/sparc/include/asm/kprobes.h | 14 +++----
 arch/sparc/kernel/kprobes.c      | 69 +++++++++++++++++++++++++++-----
 2 files changed, 66 insertions(+), 17 deletions(-)


base-commit: b3dfbde62cf1981c4638939c159dfd087b7a72e9
-- 
2.43.0


             reply	other threads:[~2026-11-13 14:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 14:40 Stian Halseth [this message]
2026-11-13 14:40 ` [PATCH v2 1/4] sparc64: kprobes: Single-step from an executable instruction slot Stian Halseth
2026-11-13 14:40 ` [PATCH v2 2/4] sparc64: kprobes: Fix up register and FP branches after single-step Stian Halseth
2026-11-13 14:40 ` [PATCH v2 3/4] sparc64: kprobes: Resume after a delay slot at the saved next PC Stian Halseth
2026-11-13 14:47   ` sashiko-bot
2026-11-13 14:40 ` [PATCH v2 4/4] sparc64: kprobes: Handle annulled branches Stian Halseth

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=20261113144057.1697874-1-stian@itx.no \
    --to=stian@itx.no \
    --cc=andreas@gaisler.com \
    --cc=danishkhateeb03@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=naveen@kernel.org \
    --cc=sparclinux@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