From: sashiko-bot@kernel.org
To: "Sahil Siddiq" <sahilcdq0@gmail.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] openrisc: Add Kretprobes
Date: Wed, 30 Sep 2026 20:41:15 +0000 [thread overview]
Message-ID: <20260930204116.4E7701F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260930203129.51048-5-sahilcdq0@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] openrisc: kretprobe trampoline leaves regs->sp and regs->sr uninitialized
--
commit a5e8b19fd4705325db24ad7195d2d69f741fc493
Author: Sahil Siddiq <sahilcdq0@gmail.com>
openrisc: Add Kretprobes
This commit adds Kretprobes support for OpenRISC by building on top of the
generic rethook framework. It implements the necessary trampoline routines to
intercept function returns and route them through the kretprobe handler.
> diff --git a/arch/openrisc/kernel/rethook_trampoline.S b/arch/openrisc/kernel/rethook_trampoline.S
> new file mode 100644
> index 0000000000000..ac4ca0ecc6694
> --- /dev/null
> +++ b/arch/openrisc/kernel/rethook_trampoline.S
[ ... ]
> + .text
> +
> + .macro save_all_base_regs
> + l.sw PT_GPR2(r1),r2
> + l.sw PT_GPR3(r1),r3
[Severity: High]
Does this macro need to save the stack pointer (r1) to the PT_SP offset and
the status register to the PT_SR offset? It appears they are omitted from the
base register save list.
[ ... ]
> +SYM_CODE_START(arch_rethook_trampoline)
> + /* Allocate enough space on stack for pt_regs */
> + l.addi r1,r1,-PT_SIZE
> + save_all_base_regs
> +
> + l.addi r3,r1,0 /* pt_regs */
> + l.jal arch_rethook_trampoline_callback
[Severity: High]
Since save_all_base_regs skips saving r1 (sp) and sr, will the pt_regs
passed into arch_rethook_trampoline_callback contain uninitialized stack
garbage for regs->sp and regs->sr?
Tracing handlers like BPF or ftrace rely on functions like
kernel_stack_pointer() and user_mode() which read these fields. Could these
uninitialized fields lead to broken stack unwinding or incorrect privilege
evaluation when the kretprobe handlers run?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260930203129.51048-1-sahilcdq0@gmail.com?part=4
next prev parent reply other threads:[~2026-09-30 20:41 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 18:56 [RFC 0/2] openrisc: Add support for KProbes Sahil Siddiq
2026-04-07 18:56 ` [RFC 1/2] openrisc: Add utilities and clean up simulation of instructions Sahil Siddiq
2026-04-14 17:11 ` Stafford Horne
2026-04-15 6:10 ` Sahil
2026-04-15 6:39 ` Masami Hiramatsu
2026-04-16 4:57 ` Sahil
2026-09-30 20:31 ` [PATCH v2 0/4] openrisc: Add support for KProbes Sahil Siddiq
2026-09-30 21:18 ` Sahil
2026-09-30 20:31 ` [PATCH v2 1/4] openrisc: Add utilities and clean up simulation of instructions Sahil Siddiq
2026-09-30 20:46 ` sashiko-bot
2026-09-30 20:31 ` [PATCH v2 2/4] openrisc: Add KProbes Sahil Siddiq
2026-09-30 20:46 ` sashiko-bot
2026-09-30 20:31 ` [PATCH v2 3/4] openrisc: Add unit tests for KProbes on branch instructions Sahil Siddiq
2026-09-30 20:41 ` sashiko-bot
2026-09-30 20:31 ` [PATCH v2 4/4] openrisc: Add Kretprobes Sahil Siddiq
2026-09-30 20:41 ` sashiko-bot [this message]
2026-04-07 18:56 ` [RFC 2/2] openrisc: Add KProbes Sahil Siddiq
2026-04-15 6:48 ` [RFC 0/2] openrisc: Add support for KProbes Masami Hiramatsu
2026-04-16 5:00 ` Sahil
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=20260930204116.4E7701F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=sahilcdq0@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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