Skip to content

RISC-V kprobes kunit test failure #2149

@nathanchance

Description

@nathanchance
$ printf 'CONFIG_%s=y\n' KPROBES KUNIT RELOCATABLE RISCV_KPROBES_KUNIT >arch/riscv/configs/repro.config

$ make -skj"$(nproc)" ARCH=riscv LLVM=1 clean defconfig repro.config Image

$ boot-qemu.py -a riscv -k .
...
[    0.000000] Linux version 6.19.0-rc4-00288-g97313d6113ab (nathan@ax162) (ClangBuiltLinux clang version 21.1.8 (https://github.com/llvm/llvm-project.git 2078da43e25a4623cab2d0d60decddf709aaea28), ClangBuiltLinux LLD 21.1.8 (https://github.com/llvm/llvm-project.git 2078da43e25a4623cab2d0d60decddf709aaea28)) #2 SMP Sat Jan 10 16:13:50 MST 2026
...
[    3.042923] KTAP version 1
[    3.043159] 1..1
[    3.043933]     KTAP version 1
[    3.044217]     # Subtest: kprobes_riscv
[    3.044759]     # module: kprobes_riscv_kunit
[    3.044957]     1..1
[    3.054033] ------------[ cut here ]------------
[    3.054416] WARNING: mm/page_alloc.c:5186 at __alloc_frozen_pages_noprof+0x160/0x228, CPU#0: kunit_try_catch/46
[    3.054982] Modules linked in:
[    3.055450] CPU: 0 UID: 0 PID: 46 Comm: kunit_try_catch Tainted: G                 N  6.19.0-rc4-00288-g97313d6113ab #2 NONE
[    3.055594] Tainted: [N]=TEST
[    3.055624] Hardware name: riscv-virtio,qemu (DT)
[    3.055763] epc : __alloc_frozen_pages_noprof+0x160/0x228
[    3.055813]  ra : ___kmalloc_large_node+0x52/0x1bc
[    3.055840] epc : ffffffff80243c80 ra : ffffffff8024d632 sp : ff200000001fbc10
[    3.055862]  gp : ffffffff81a2a118 tp : ff600000028cb100 t0 : 0000000054b78c79
[    3.055882]  t1 : 0000000054b78c79 t2 : 00000000000aae60 s0 : ff200000001fbc90
[    3.055902]  s1 : 000000000aa76390 a0 : 0000000000000001 a1 : ffffffff819eab52
[    3.055924]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 000000003b9aca00
[    3.055944]  a5 : 0000000000028fdc a6 : 000000005530bddd a7 : 00000000000aae60
[    3.055964]  s2 : 0000000000000010 s3 : ffffffff8024dfa2 s4 : 0000000000000dc0
[    3.055983]  s5 : ffffffff80018fc4 s6 : ff2000000000bb40 s7 : 0000000000000000
[    3.056002]  s8 : 0000000000000000 s9 : 000000000016ba6e s10: 0000000000000000
[    3.056020]  s11: 0000000000000000 t3 : 0000000000000000 t4 : 0000000000000002
[    3.056036]  t5 : 000000005530bddd t6 : 0000000000000001
[    3.056054] status: 0000000200000120 badaddr: ffffffff80243c80 cause: 0000000000000003
[    3.056213] [<ffffffff80243c80>] __alloc_frozen_pages_noprof+0x160/0x228
[    3.056374] [<ffffffff8024d632>] ___kmalloc_large_node+0x52/0x1bc
[    3.056390] [<ffffffff8024d800>] __kmalloc_large_node_noprof+0x1c/0x114
[    3.056405] [<ffffffff8024dfa2>] __kmalloc_noprof+0x252/0x450
[    3.056418] [<ffffffff80018c8a>] test_kprobe_riscv+0x5a/0x210
[    3.056439] [<ffffffff80517b3e>] kunit_try_run_case+0x5a/0x15c
[    3.056460] [<ffffffff80519b32>] kunit_generic_run_threadfn_adapter+0x1a/0x34
[    3.056478] [<ffffffff8004fbc0>] kthread+0x178/0x1a0
[    3.056495] [<ffffffff80013142>] ret_from_fork_kernel+0xe/0x6c
[    3.056518] [<ffffffff80b76226>] ret_from_fork_kernel_asm+0x16/0x1c
[    3.056606] ---[ end trace 0000000000000000 ]---
[    3.072192]     # test_kprobe_riscv: EXPECTATION FAILED at arch/riscv/kernel/tests/kprobes/test-kprobes.c:24
[    3.072192]     Expected kp to be true, but is false
[    3.075489]     not ok 1 test_kprobe_riscv
[    3.075705] not ok 1 kprobes_riscv
...

See the v1 of the proposed fix and upstream LLVM bug report for more information.

The v2 of the proposed fix has been queued in the RISC-V tree for a 6.19-rc release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Reported upstreamThis bug was filed on LLVM’s issue tracker, Phabricator, or the kernel mailing list.[BUG] linuxA bug that should be fixed in the mainline kernel.[PATCH] AcceptedA submitted patch has been accepted upstream

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions