[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87frc9h0lo.fsf@yellow.woof>
Date: Fri, 26 Sep 2025 14:14:43 +0200
From: Nam Cao <namcao@...utronix.de>
To: Thomas Huth <thuth@...hat.com>, Paul Walmsley
<paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>, Albert Ou
<aou@...s.berkeley.edu>, Alexandre Ghiti <alex@...ti.fr>,
linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] riscv: Add kprobes KUnit test
Thomas Huth <thuth@...hat.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@...utronix.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
Powered by blists - more mailing lists