From: Nam Cao <namcao@linutronix.de>
To: Thomas Huth <thuth@redhat.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] riscv: Add kprobes KUnit test
Date: Fri, 26 Sep 2025 14:14:43 +0200 [thread overview]
Message-ID: <87frc9h0lo.fsf@yellow.woof> (raw)
In-Reply-To: <16b74b63-f223-4f0b-b6e5-31cea5e620b4@redhat.com>
Thomas Huth <thuth@redhat.com> writes:
> On 13/05/2025 17.16, Nam Cao wrote:
>> Add KUnit test for riscv kprobes, mostly for simulated instructions. The
>> test install kprobes into multiple sample functions, and check that these
>> functions still return the expected magic value.
>>
>> This test can detect some kprobe bugs reported in the past (in Link:).
>>
>> Link: https://lore.kernel.org/linux-riscv/20241119111056.2554419-1-namcao@linutronix.de/
>> Link: https://lore.kernel.org/stable/c7e463c0-8cad-4f4e-addd-195c06b7b6de@iscas.ac.cn/
>> Link: https://lore.kernel.org/linux-riscv/20230829182500.61875-1-namcaov@gmail.com/
>> Signed-off-by: Nam Cao <namcao@linutronix.de>
>> ---
> ...
>> diff --git a/arch/riscv/kernel/tests/kprobes/test-kprobes.h b/arch/riscv/kernel/tests/kprobes/test-kprobes.h
>> new file mode 100644
>> index 000000000000..3886ab491ecb
>> --- /dev/null
>> +++ b/arch/riscv/kernel/tests/kprobes/test-kprobes.h
>> @@ -0,0 +1,24 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +#ifndef TEST_KPROBES_H
>> +#define TEST_KPROBES_H
>> +
>> +/*
>> + * The magic value that all the functions in the test_kprobes_functions array return. The test
>> + * installs kprobes into these functions, and verify that the functions still correctly return this
>> + * value.
>> + */
>> +#define KPROBE_TEST_MAGIC 0xcafebabe
>> +#define KPROBE_TEST_MAGIC_LOWER 0x0000babe
>> +#define KPROBE_TEST_MAGIC_UPPER 0xcafe0000
>> +
>> +#ifndef __ASSEMBLY__
>
> Could you maybe change that into "__ASSEMBLER__" instead of "__ASSEMBLY__" ?
> I'm currently trying to get rid of the latter in the kernel sources, see:
> https://lore.kernel.org/all/20250606070952.498274-1-thuth@redhat.com/
It's been applied, it's up to riscv's maintainers how we should do this.
I can send v3, or a follow-up patch.
Or riscv maintainers can also squash that change into this patch, or
into your patch.
I'm fine with any options.
Nam
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Nam Cao <namcao@linutronix.de>
To: Thomas Huth <thuth@redhat.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] riscv: Add kprobes KUnit test
Date: Fri, 26 Sep 2025 14:14:43 +0200 [thread overview]
Message-ID: <87frc9h0lo.fsf@yellow.woof> (raw)
In-Reply-To: <16b74b63-f223-4f0b-b6e5-31cea5e620b4@redhat.com>
Thomas Huth <thuth@redhat.com> writes:
> On 13/05/2025 17.16, Nam Cao wrote:
>> Add KUnit test for riscv kprobes, mostly for simulated instructions. The
>> test install kprobes into multiple sample functions, and check that these
>> functions still return the expected magic value.
>>
>> This test can detect some kprobe bugs reported in the past (in Link:).
>>
>> Link: https://lore.kernel.org/linux-riscv/20241119111056.2554419-1-namcao@linutronix.de/
>> Link: https://lore.kernel.org/stable/c7e463c0-8cad-4f4e-addd-195c06b7b6de@iscas.ac.cn/
>> Link: https://lore.kernel.org/linux-riscv/20230829182500.61875-1-namcaov@gmail.com/
>> Signed-off-by: Nam Cao <namcao@linutronix.de>
>> ---
> ...
>> diff --git a/arch/riscv/kernel/tests/kprobes/test-kprobes.h b/arch/riscv/kernel/tests/kprobes/test-kprobes.h
>> new file mode 100644
>> index 000000000000..3886ab491ecb
>> --- /dev/null
>> +++ b/arch/riscv/kernel/tests/kprobes/test-kprobes.h
>> @@ -0,0 +1,24 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +#ifndef TEST_KPROBES_H
>> +#define TEST_KPROBES_H
>> +
>> +/*
>> + * The magic value that all the functions in the test_kprobes_functions array return. The test
>> + * installs kprobes into these functions, and verify that the functions still correctly return this
>> + * value.
>> + */
>> +#define KPROBE_TEST_MAGIC 0xcafebabe
>> +#define KPROBE_TEST_MAGIC_LOWER 0x0000babe
>> +#define KPROBE_TEST_MAGIC_UPPER 0xcafe0000
>> +
>> +#ifndef __ASSEMBLY__
>
> Could you maybe change that into "__ASSEMBLER__" instead of "__ASSEMBLY__" ?
> I'm currently trying to get rid of the latter in the kernel sources, see:
> https://lore.kernel.org/all/20250606070952.498274-1-thuth@redhat.com/
It's been applied, it's up to riscv's maintainers how we should do this.
I can send v3, or a follow-up patch.
Or riscv maintainers can also squash that change into this patch, or
into your patch.
I'm fine with any options.
Nam
next prev parent reply other threads:[~2025-09-26 12:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-13 15:16 [PATCH v2] riscv: Add kprobes KUnit test Nam Cao
2025-05-13 15:16 ` Nam Cao
2025-05-14 8:22 ` Alexandre Ghiti
2025-05-14 8:22 ` Alexandre Ghiti
2025-05-14 10:01 ` Nam Cao
2025-05-14 10:01 ` Nam Cao
2025-06-04 14:33 ` patchwork-bot+linux-riscv
2025-06-04 14:33 ` patchwork-bot+linux-riscv
2025-09-26 11:51 ` Thomas Huth
2025-09-26 11:51 ` Thomas Huth
2025-09-26 12:14 ` Nam Cao [this message]
2025-09-26 12:14 ` Nam Cao
2025-09-29 10:19 ` Nam Cao
2025-09-29 10:19 ` Nam Cao
2025-10-10 22:03 ` Paul Walmsley
2025-10-10 22:03 ` Paul Walmsley
2025-10-13 5:15 ` Thomas Huth
2025-10-13 5:15 ` Thomas Huth
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=87frc9h0lo.fsf@yellow.woof \
--to=namcao@linutronix.de \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=thuth@redhat.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 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.