Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Sahil Siddiq" <sahilcdq0@gmail.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/4] openrisc: Add unit tests for KProbes on branch instructions
Date: Wed, 30 Sep 2026 20:41:21 +0000	[thread overview]
Message-ID: <20260930204121.ED3061F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260930203129.51048-4-sahilcdq0@gmail.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] openrisc: uninitialized return value causes kprobe test to unconditionally fail
- [Medium] openrisc: flaky test in test_kprobes_adrp due to missing alignment
--

commit d52f067996dd8c21d999dffa9e89c92071ac2e93
Author: Sahil Siddiq <sahilcdq0@gmail.com>

openrisc: Add unit tests for KProbes on branch instructions

Tests already exist lib/tests to verify the generic functionality of
KProbes. Add unit tests to verify that KProbes work on instructions
that require simulation in the OpenRISC ISA, and that the corresponding
delay slots are handled correctly.

> diff --git a/arch/openrisc/kernel/tests/test_kprobes_asm.S b/arch/openrisc/kernel/tests/test_kprobes_asm.S
> new file mode 100644
> index 0000000000000..a9fcf99b55ae1
> --- /dev/null
> +++ b/arch/openrisc/kernel/tests/test_kprobes_asm.S

[ ... ]

> +SYM_FUNC_START(test_kprobes_adrp)
> +	l.addi	r13,r0,0
> +	l.addi	r15,r9,0
> +	l.addi	r17,r0,-8192
> +	l.jal	1f
> +	l.nop
> +1:	l.and	r19,r9,r17
> +test_kprobes_adrp_addr:
> +	l.adrp	r21,0
> +	l.sfeq	r21,r19

[Severity: Medium]
Will this test be flaky due to a lack of alignment directives?

The test verifies the l.adrp instruction by evaluating if it computes the
same page base as the 1: label. It derives the page address of 1: by masking
its address with -8192, and compares it to the page base computed by l.adrp
on the next instruction.

Since there is no alignment directive, the 1: label and the l.adrp
instruction might straddle an 8KB page boundary during linkage (e.g., if 1:
is at 0x1FFC and l.adrp is at 0x2000). If they cross the boundary, the two
page bases won't match, causing the test to incorrectly branch away to the
failure path.

> +	l.bnf	2f
> +	l.nop
> +	l.movhi	r13,KPROBE_TEST_MAGIC_UPPER
> +	l.ori	r13,r13,KPROBE_TEST_MAGIC_LOWER
> +2:	l.addi	r9,r15,0
> +	l.jr	r9

[Severity: Medium]
Does this function omit setting the return register, causing the kprobe test
to unconditionally fail?

The inline assembly successfully loads the magic value into r13 but omits
the l.addi r11, r13, 0 instruction required by the OpenRISC calling
convention to move it into the return register (r11) before returning.

Because of this, test_kprobes_adrp() will return whatever garbage data was
in r11.

> +	l.nop
> +SYM_FUNC_END(test_kprobes_adrp)

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260930203129.51048-1-sahilcdq0@gmail.com?part=3

  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 [this message]
2026-09-30 20:31   ` [PATCH v2 4/4] openrisc: Add Kretprobes Sahil Siddiq
2026-09-30 20:41     ` sashiko-bot
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=20260930204121.ED3061F000FF@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