| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/08/05 07:13 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": [
"KVM",
"VIRTUALIZATION"
],
"FocusSymbols": [
"kvm_arch_vcpu_ioctl_run"
],
"Reasoning": "The patch introduces a new WFI trap policy for RISC-V KVM guests, controlled by a kernel command-line parameter. It modifies the `kvm_arch_vcpu_ioctl_run` loop to re-evaluate the trap policy before each guest entry. This is a functional change to the core KVM execution loop on RISC-V and can be reached and tested in virtualized environments.",
"WorthFuzzing": true
} |
| 1/1 | 2026/08/05 07:13 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit 27fe9de37ca12c0d8202813d63849acbb1e5a69e\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Wed Aug 5 07:13:58 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt\nindex b5493a7f8f228..2ab9eb335e60b 100644\n--- a/Documentation/admin-guide/kernel-parameters.txt\n+++ b/Documentation/admin-guide/kernel-parameters.txt\n@@ -3254,6 +3254,26 @@ Kernel parameters\n \n \t\t\tnotrap: clear WFI instruction trap\n \n+\tkvm-riscv.wfi_trap_policy=\n+\t\t\t[KVM,RISCV] Control when to set the WFI instruction\n+\t\t\ttrap (HSTATUS.VTW) for KVM VMs. The policy is\n+\t\t\tre-evaluated before each guest entry, not only at\n+\t\t\treset, since RISC-V WFI is only a hint.\n+\n+\t\t\ttrap: always trap VS-mode WFI into KVM (HSTATUS.VTW=1)\n+\n+\t\t\tauto: trap unless the vCPU is the only runnable task on\n+\t\t\t\tthe current CPU, in which case clear the trap\n+\t\t\t\t(HSTATUS.VTW=0) and let the guest execute WFI\n+\t\t\t\tnatively\n+\n+\t\t\tDefaults to trap, preserving the previous unconditional\n+\t\t\tbehavior.\n+\n+\t\t\tOnly honored when KVM is built into the kernel\n+\t\t\t(CONFIG_KVM=y); as a module (CONFIG_KVM=m) the policy\n+\t\t\tstays at its default (trap).\n+\n \tkvm_cma_resv_ratio=n [PPC,EARLY]\n \t\t\tReserves given percentage from system memory area for\n \t\t\tcontiguous memory allocation for KVM hash pagetable\ndiff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c\nindex cf6e231e76e25..8efeb74699cc9 100644\n--- a/arch/riscv/kvm/vcpu.c\n+++ b/arch/riscv/kvm/vcpu.c\n@@ -12,8 +12,10 @@\n #include \u003clinux/kdebug.h\u003e\n #include \u003clinux/module.h\u003e\n #include \u003clinux/percpu.h\u003e\n+#include \u003clinux/string.h\u003e\n #include \u003clinux/vmalloc.h\u003e\n #include \u003clinux/sched/signal.h\u003e\n+#include \u003clinux/sched/stat.h\u003e\n #include \u003clinux/fs.h\u003e\n #include \u003clinux/kvm_host.h\u003e\n #include \u003casm/cacheflush.h\u003e\n@@ -26,6 +28,67 @@\n \n static DEFINE_PER_CPU(struct kvm_vcpu *, kvm_former_vcpu);\n \n+/*\n+ * WFI trap policy for VS-mode guests, controllable through the\n+ * kvm-riscv.wfi_trap_policy= kernel command-line option.\n+ */\n+enum kvm_riscv_wfi_trap_policy {\n+\tKVM_RISCV_WFI_TRAP,\t/* Always trap VS-mode WFI into KVM */\n+\tKVM_RISCV_WFI_AUTO,\t/* Trap unless the vCPU is the only runnable task */\n+};\n+\n+static enum kvm_riscv_wfi_trap_policy kvm_riscv_wfi_trap_policy __read_mostly =\n+\tKVM_RISCV_WFI_TRAP;\n+\n+/*\n+ * RISC-V KVM is tristate and may be built as a module, but early_param() is\n+ * only defined for built-in code (see \u003clinux/init.h\u003e). Guard the command-line\n+ * parser accordingly: when CONFIG_KVM=m the policy simply keeps its default\n+ * (trap) value, which is the safe, regression-free behavior.\n+ */\n+#ifndef MODULE\n+static int __init early_kvm_riscv_wfi_trap_policy_cfg(char *arg)\n+{\n+\tif (!arg)\n+\t\treturn -EINVAL;\n+\n+\tif (strcmp(arg, \"trap\") == 0) {\n+\t\tkvm_riscv_wfi_trap_policy = KVM_RISCV_WFI_TRAP;\n+\t\treturn 0;\n+\t}\n+\n+\tif (strcmp(arg, \"auto\") == 0) {\n+\t\tkvm_riscv_wfi_trap_policy = KVM_RISCV_WFI_AUTO;\n+\t\treturn 0;\n+\t}\n+\n+\treturn -EINVAL;\n+}\n+early_param(\"kvm-riscv.wfi_trap_policy\", early_kvm_riscv_wfi_trap_policy_cfg);\n+#endif\n+\n+static bool kvm_riscv_vcpu_wfi_should_trap(struct kvm_vcpu *vcpu)\n+{\n+\tswitch (kvm_riscv_wfi_trap_policy) {\n+\tcase KVM_RISCV_WFI_AUTO:\n+\t\t/* Native WFI only when the vCPU is the sole runnable task. */\n+\t\treturn !single_task_running();\n+\tcase KVM_RISCV_WFI_TRAP:\n+\tdefault:\n+\t\treturn true;\n+\t}\n+}\n+\n+static void kvm_riscv_vcpu_update_wfi_trap(struct kvm_vcpu *vcpu)\n+{\n+\tstruct kvm_cpu_context *cntx = \u0026vcpu-\u003earch.guest_context;\n+\n+\tif (kvm_riscv_vcpu_wfi_should_trap(vcpu))\n+\t\tcntx-\u003ehstatus |= HSTATUS_VTW;\n+\telse\n+\t\tcntx-\u003ehstatus \u0026= ~HSTATUS_VTW;\n+}\n+\n const struct kvm_stats_desc kvm_vcpu_stats_desc[] = {\n \tKVM_GENERIC_VCPU_STATS(),\n \tSTATS_DESC_COUNTER(VCPU, ecall_exit_stat),\n@@ -73,6 +136,7 @@ static void kvm_riscv_vcpu_context_reset(struct kvm_vcpu *vcpu,\n \t/* Setup reset state of shadow SSTATUS and HSTATUS CSRs */\n \tcntx-\u003esstatus = SR_SPP | SR_SPIE;\n \n+\t/* Trap VS-mode WFI by default; the run loop reapplies the policy before each entry. */\n \tcntx-\u003ehstatus |= HSTATUS_VTW;\n \tcntx-\u003ehstatus |= HSTATUS_SPVP;\n \tcntx-\u003ehstatus |= HSTATUS_SPV;\n@@ -936,6 +1000,14 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)\n \t\t */\n \t\tkvm_riscv_local_tlb_sanitize(vcpu);\n \n+\t\t/*\n+\t\t * Re-evaluate the WFI trap policy for this entry so that\n+\t\t * HSTATUS.VTW tracks the current runnable-task count and\n+\t\t * cannot go stale across guest entries (which would let a\n+\t\t * native WFI halt the CPU while another task is runnable).\n+\t\t */\n+\t\tkvm_riscv_vcpu_update_wfi_trap(vcpu);\n+\n \t\ttrace_kvm_entry(vcpu);\n \n \t\tguest_timing_enter_irqoff();\n"
} |
| 2/1 | 2026/08/05 07:13 | agent | patch-evaluator |
0mModel:best-expensive Args: null Results: {
"EnableConfigs": [
"KVM",
"VIRTUALIZATION"
],
"FocusSymbols": [
"kvm_arch_vcpu_ioctl_run"
],
"Reasoning": "The patch introduces a new WFI trap policy for RISC-V KVM guests, controlled by a kernel command-line parameter. It modifies the `kvm_arch_vcpu_ioctl_run` loop to re-evaluate the trap policy before each guest entry. This is a functional change to the core KVM execution loop on RISC-V and can be reached and tested in virtualized environments.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer. Your job is to review a provided patch series and determine if it makes functional changes to the kernel that should be fuzzed. IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively use your code access tools to examine the actual source code and confirm any assumptions. Return WorthFuzzing=false if the patch only contains: - Modifications to Documentation/, Kconfig files, or code comments. - Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints. - Changes to numeric constants or macros that do not functionally alter execution flow. - Code paths that are impossible to reach in virtualized environments like GCE or QEMU, even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim). - Code in vendor-specific PCIe switch, SmartNIC, or GPU drivers (e.g., mlxsw, pds_core, qed, ionic, amdgpu) that require physical PCIe hardware cards not emulated in standard QEMU. - Driver .remove, .shutdown, or pci_unregister_driver teardown callbacks (e.g., igb_remove) that are executed only during PCI hot-unplug or sysfs driver unbind operations. If it modifies reachable core kernel logic, drivers, or architectures, use your code search tools to verify the code can be executed, then return WorthFuzzing=true. When returning WorthFuzzing=true, you MUST ALSO: 1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols. Avoid listing generic hot-path functions to prevent skewed test distributions. Prefer non-static, non-inlined API entrypoint functions over internal static helper functions (which are inlined by the compiler and do not have distinct symbol addresses). 2. Identify any specific CONFIG_ options required to properly test this new/modified feature. Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions. Also check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed for Kbuild to compile the code statically into vmlinux. List them in the EnableConfigs output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4"). Prefer calling several tools at the same time to save round-trips. Use set-results tool to provide results of the analysis. It must be called exactly once before the final reply. Ignore results of this tool. Prompt: For your convenience, here is the diff of the changes:
commit 27fe9de37ca12c0d8202813d63849acbb1e5a69e
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Aug 5 07:13:58 2026 +0000
syz-cluster: applied patch under review
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index b5493a7f8f228..2ab9eb335e60b 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3254,6 +3254,26 @@ Kernel parameters
notrap: clear WFI instruction trap
+ kvm-riscv.wfi_trap_policy=
+ [KVM,RISCV] Control when to set the WFI instruction
+ trap (HSTATUS.VTW) for KVM VMs. The policy is
+ re-evaluated before each guest entry, not only at
+ reset, since RISC-V WFI is only a hint.
+
+ trap: always trap VS-mode WFI into KVM (HSTATUS.VTW=1)
+
+ auto: trap unless the vCPU is the only runnable task on
+ the current CPU, in which case clear the trap
+ (HSTATUS.VTW=0) and let the guest execute WFI
+ natively
+
+ Defaults to trap, preserving the previous unconditional
+ behavior.
+
+ Only honored when KVM is built into the kernel
+ (CONFIG_KVM=y); as a module (CONFIG_KVM=m) the policy
+ stays at its default (trap).
+
kvm_cma_resv_ratio=n [PPC,EARLY]
Reserves given percentage from system memory area for
contiguous memory allocation for KVM hash pagetable
diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c
index cf6e231e76e25..8efeb74699cc9 100644
--- a/arch/riscv/kvm/vcpu.c
+++ b/arch/riscv/kvm/vcpu.c
@@ -12,8 +12,10 @@
#include <linux/kdebug.h>
#include <linux/module.h>
#include <linux/percpu.h>
+#include <linux/string.h>
#include <linux/vmalloc.h>
#include <linux/sched/signal.h>
+#include <linux/sched/stat.h>
#include <linux/fs.h>
#include <linux/kvm_host.h>
#include <asm/cacheflush.h>
@@ -26,6 +28,67 @@
static DEFINE_PER_CPU(struct kvm_vcpu *, kvm_former_vcpu);
+/*
+ * WFI trap policy for VS-mode guests, controllable through the
+ * kvm-riscv.wfi_trap_policy= kernel command-line option.
+ */
+enum kvm_riscv_wfi_trap_policy {
+ KVM_RISCV_WFI_TRAP, /* Always trap VS-mode WFI into KVM */
+ KVM_RISCV_WFI_AUTO, /* Trap unless the vCPU is the only runnable task */
+};
+
+static enum kvm_riscv_wfi_trap_policy kvm_riscv_wfi_trap_policy __read_mostly =
+ KVM_RISCV_WFI_TRAP;
+
+/*
+ * RISC-V KVM is tristate and may be built as a module, but early_param() is
+ * only defined for built-in code (see <linux/init.h>). Guard the command-line
+ * parser accordingly: when CONFIG_KVM=m the policy simply keeps its default
+ * (trap) value, which is the safe, regression-free behavior.
+ */
+#ifndef MODULE
+static int __init early_kvm_riscv_wfi_trap_policy_cfg(char *arg)
+{
+ if (!arg)
+ return -EINVAL;
+
+ if (strcmp(arg, "trap") == 0) {
+ kvm_riscv_wfi_trap_policy = KVM_RISCV_WFI_TRAP;
+ return 0;
+ }
+
+ if (strcmp(arg, "auto") == 0) {
+ kvm_riscv_wfi_trap_policy = KVM_RISCV_WFI_AUTO;
+ return 0;
+ }
+
+ return -EINVAL;
+}
+early_param("kvm-riscv.wfi_trap_policy", early_kvm_riscv_wfi_trap_policy_cfg);
+#endif
+
+static bool kvm_riscv_vcpu_wfi_should_trap(struct kvm_vcpu *vcpu)
+{
+ switch (kvm_riscv_wfi_trap_policy) {
+ case KVM_RISCV_WFI_AUTO:
+ /* Native WFI only when the vCPU is the sole runnable task. */
+ return !single_task_running();
+ case KVM_RISCV_WFI_TRAP:
+ default:
+ return true;
+ }
+}
+
+static void kvm_riscv_vcpu_update_wfi_trap(struct kvm_vcpu *vcpu)
+{
+ struct kvm_cpu_context *cntx = &vcpu->arch.guest_context;
+
+ if (kvm_riscv_vcpu_wfi_should_trap(vcpu))
+ cntx->hstatus |= HSTATUS_VTW;
+ else
+ cntx->hstatus &= ~HSTATUS_VTW;
+}
+
const struct kvm_stats_desc kvm_vcpu_stats_desc[] = {
KVM_GENERIC_VCPU_STATS(),
STATS_DESC_COUNTER(VCPU, ecall_exit_stat),
@@ -73,6 +136,7 @@ static void kvm_riscv_vcpu_context_reset(struct kvm_vcpu *vcpu,
/* Setup reset state of shadow SSTATUS and HSTATUS CSRs */
cntx->sstatus = SR_SPP | SR_SPIE;
+ /* Trap VS-mode WFI by default; the run loop reapplies the policy before each entry. */
cntx->hstatus |= HSTATUS_VTW;
cntx->hstatus |= HSTATUS_SPVP;
cntx->hstatus |= HSTATUS_SPV;
@@ -936,6 +1000,14 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
*/
kvm_riscv_local_tlb_sanitize(vcpu);
+ /*
+ * Re-evaluate the WFI trap policy for this entry so that
+ * HSTATUS.VTW tracks the current runnable-task count and
+ * cannot go stale across guest entries (which would let a
+ * native WFI halt the CPU while another task is runnable).
+ */
+ kvm_riscv_vcpu_update_wfi_trap(vcpu);
+
trace_kvm_entry(vcpu);
guest_timing_enter_irqoff();
|
| 3/2 | 2026/08/05 07:13 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 3639 output: 33 thoughts: 291 Thoughts: **Analyzing the RISC-V KVM Patch** Okay, so I'm looking at this patch that introduces a new kernel parameter, `kvm-riscv.wfi_trap_policy`, to RISC-V KVM. It seems like it's a functional change, modifying `arch/riscv/kvm/vcpu.c` by adding `kvm_riscv_vcpu_wfi_should_trap` and `kvm_riscv_vcpu_update_wfi_trap`. Specifically, `kvm_riscv_vcpu_update_wfi_trap` is called within `kvm_arch_vcpu_ioctl_run`. My initial thought is, is this something we should consider for fuzzing? Absolutely. It’s a functional change to the KVM implementation, and that's a prime target. Now, I need to think about reachability. Can this *actually* be tested in a virtualized environment? Of course, KVM on RISC-V is perfectly viable using something like QEMU. That solves that. The next thing I'm thinking about is whether Syzkaller can be used here. I know it's used for x86 KVM, but what about RISC-V? A quick check should confirm that Syzkaller supports RISC-V, and KVM is definitely a core feature, so we should be good to go. Finally, are there any specific kernel configurations I need to keep in mind? Probably. Let's start with the basics – we'll need `CONFIG_KVM`, that's a given. Now, let's take a look at `arch/riscv/kvm/Kconfig` to see if there are any specific RISC-V-related configurations that might be required. |
| 4/2 | 2026/08/05 07:14 | tool | grepper |
0mArgs:{
"Expression": "config KVM",
"PathPrefix": "arch/riscv/kvm/Kconfig"
}Results: {
"Output": "arch/riscv/kvm/Kconfig=18=if VIRTUALIZATION\narch/riscv/kvm/Kconfig-19-\narch/riscv/kvm/Kconfig:20:config KVM\narch/riscv/kvm/Kconfig-21-\ttristate \"Kernel-based Virtual Machine (KVM) support\"\n"
} |
| 5/2 | 2026/08/05 07:14 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 4447 output: 36 thoughts: 25 Thoughts: Okay, let's break this down. **Investigating Virtualization Dependencies** Hmm, I need to understand the architectural dependencies here, specifically with regards to virtualization. My immediate thought is, "What are the core components that `VIRTUALIZATION` *relies* upon?" This could be anything from the underlying hardware architecture to specific kernel modules or libraries. I'm also curious to see if the relationship is the reverse, so I will analyze what `KVM` may need, and if anything else *requires* it. It's about establishing a clear dependency graph, either way. It's about figuring out the critical path for this technology. |
| 6/2 | 2026/08/05 07:14 | tool | read-file |
0mArgs:{
"File": "arch/riscv/kvm/Kconfig",
"FirstLine": 1,
"LineCount": 50
}Results: {
"Contents": " 1:\t# SPDX-License-Identifier: GPL-2.0\n 2:\t#\n 3:\t# KVM configuration\n 4:\t#\n 5:\t\n 6:\tsource \"virt/kvm/Kconfig\"\n 7:\t\n 8:\tmenuconfig VIRTUALIZATION\n 9:\t\tbool \"Virtualization\"\n 10:\t\thelp\n 11:\t\t Say Y here to get to see options for using your Linux host to run\n 12:\t\t other operating systems inside virtual machines (guests).\n 13:\t\t This option alone does not add any kernel code.\n 14:\t\n 15:\t\t If you say N, all options in this submenu will be skipped and\n 16:\t\t disabled.\n 17:\t\n 18:\tif VIRTUALIZATION\n 19:\t\n 20:\tconfig KVM\n 21:\t\ttristate \"Kernel-based Virtual Machine (KVM) support\"\n 22:\t\tdepends on RISCV_SBI \u0026\u0026 MMU\n 23:\t\tselect HAVE_KVM_IRQCHIP\n 24:\t\tselect HAVE_KVM_IRQ_ROUTING\n 25:\t\tselect HAVE_KVM_MSI\n 26:\t\tselect HAVE_KVM_READONLY_MEM\n 27:\t\tselect HAVE_KVM_DIRTY_RING_ACQ_REL\n 28:\t\tselect KVM_COMMON\n 29:\t\tselect KVM_GENERIC_DIRTYLOG_READ_PROTECT\n 30:\t\tselect KVM_GENERIC_HARDWARE_ENABLING\n 31:\t\tselect KVM_MMIO\n 32:\t\tselect VIRT_XFER_TO_GUEST_WORK\n 33:\t\tselect SCHED_INFO\n 34:\t\tselect GUEST_PERF_EVENTS if PERF_EVENTS\n 35:\t\thelp\n 36:\t\t Support hosting virtualized guest machines.\n 37:\t\n 38:\t\t If unsure, say N.\n 39:\t\n 40:\tendif # VIRTUALIZATION\n"
} |
| 7/2 | 2026/08/05 07:14 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 5161 output: 32 thoughts: 985 Thoughts: **Analyzing the KVM RISC-V WFI Trap Policy Patch** Okay, so I'm looking at this patch for the KVM RISC-V WFI trap policy. First, I need to confirm the required configurations are in place – `CONFIG_KVM` and `CONFIG_VIRTUALIZATION`. The core of this patch seems to center around `kvm_arch_vcpu_ioctl_run`. That's the primary entry point for the `KVM_RUN` ioctl, where the virtual CPU execution begins. Initially, my instinct was to avoid overly hot functions, as the instructions say, and prefer non-static API entry points. However, `kvm_arch_vcpu_ioctl_run` is *the* entry point. It's the ioctl handler, the gateway. So, while it's undeniably hot, it's also critical. I see a couple of static functions modified: `kvm_riscv_vcpu_update_wfi_trap` and `kvm_riscv_vcpu_wfi_should_trap`. There's also `early_kvm_riscv_wfi_trap_policy_cfg`, which is `__init`. A one-line comment change in `kvm_riscv_vcpu_context_reset` is also present. This one is interesting: the change mentions trapping VS-mode WFI by default. But it seems to be just a comment. The important piece appears to be `kvm_arch_vcpu_ioctl_run` calling `kvm_riscv_vcpu_update_wfi_trap`. Given that `kvm_arch_vcpu_ioctl_run` is the only non-static function modified, it seems that I should include it, or not include anything if it's too hot. But, in this instance it is the ioctl handler for `KVM_RUN`, so it is the primary entry point. So I will include `kvm_arch_vcpu_ioctl_run`. There aren't any other non-static functions modified. Now, a new command-line parameter, `kvm-riscv.wfi_trap_policy`, is introduced. I recall that Syzkaller might not directly fuzz command-line parameters, unless configured to do so. The default value is `trap`. Here's the catch: if the default is `trap`, then `kvm_riscv_vcpu_wfi_should_trap` will *always* return `true`, and the `HSTATUS_VTW` bit will be set. This default, therefore, maintains the previous behavior of trapping on WFI unconditionally. The only change appears to be that the bit is set before every entry instead of just at reset. The question then is whether there's an actual functional change. Previously, `HSTATUS_VTW` was set in `kvm_riscv_vcpu_context_reset`. The guest *could* clear it. I should check if `HSTATUS_VTW` can be modified by the guest or other KVM code. This is a critical detail for determining the impact of this "default" behavior. |
| 8/2 | 2026/08/05 07:14 | tool | grepper |
0mArgs:{
"Expression": "HSTATUS_VTW",
"PathPrefix": "arch/riscv/kvm"
}Results: {
"Output": "arch/riscv/kvm/vcpu.c=82=static void kvm_riscv_vcpu_update_wfi_trap(struct kvm_vcpu *vcpu)\n--\narch/riscv/kvm/vcpu.c-86-\tif (kvm_riscv_vcpu_wfi_should_trap(vcpu))\narch/riscv/kvm/vcpu.c:87:\t\tcntx-\u003ehstatus |= HSTATUS_VTW;\narch/riscv/kvm/vcpu.c-88-\telse\narch/riscv/kvm/vcpu.c:89:\t\tcntx-\u003ehstatus \u0026= ~HSTATUS_VTW;\narch/riscv/kvm/vcpu.c-90-}\n--\narch/riscv/kvm/vcpu.c=119=static void kvm_riscv_vcpu_context_reset(struct kvm_vcpu *vcpu,\n--\narch/riscv/kvm/vcpu.c-139-\t/* Trap VS-mode WFI by default; the run loop reapplies the policy before each entry. */\narch/riscv/kvm/vcpu.c:140:\tcntx-\u003ehstatus |= HSTATUS_VTW;\narch/riscv/kvm/vcpu.c-141-\tcntx-\u003ehstatus |= HSTATUS_SPVP;\n"
} |
| 9/2 | 2026/08/05 07:14 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 7203 output: 29 thoughts: 777 Thoughts: **My Assessment of the Patch's Fuzzing Worthiness** Okay, let's break this down. It looks like `HSTATUS_VTW` was only set in `kvm_riscv_vcpu_context_reset` but never explicitly cleared. The current default behavior is largely the same as before, except now `HSTATUS_VTW` is reapplied before each entry. This begs the question: is this even worth fuzzing? Initially, I was hesitant because it seems like a minor change on the surface. The patch introduces a new feature that's *disabled* by default, requiring the `kvm-riscv.wfi_trap_policy=auto` kernel command-line parameter. Syzkaller won't automatically add that, so it sounds like a dead end. However, a deeper dive shows that the patch does *modify* `kvm_arch_vcpu_ioctl_run`. It now calls `kvm_riscv_vcpu_update_wfi_trap`, which contains a switch statement and manipulates a bit. This is a functional change to KVM's run loop, even if the *default* behavior is nearly identical. The prompt guides me well, stating that the patch is worth fuzzing if it touches "reachable core kernel logic". Since this patch *does* modify core KVM logic on RISC-V, the answer is a definitive **WorthFuzzing=true**. Now, let's ensure I'm getting the `EnableConfigs` right. I've confirmed that `kvm_arch_vcpu_ioctl_run` is the only function modified. The prompt states that if "depends on" lines in Kconfig exist, they need to be listed. The base configs are `KVM` and `VIRTUALIZATION`. `VIRTUALIZATION` is a menuconfig, which implies a config symbol. I checked and `VIRTUALIZATION` *is* required because `if VIRTUALIZATION` surrounds `config KVM`. The check showed `KVM` depends on `RISCV_SBI` and `MMU`. `MMU` is standard, and `RISCV_SBI` is standard for RISC-V. Therefore, I will include `KVM` and `VIRTUALIZATION`. I will also need to include `RISCV_SBI` since it is specified in a "depends on" line in Kconfig. So, my `EnableConfigs` array needs to contain: `KVM`, `VIRTUALIZATION`, `RISCV_SBI` |
| 10/2 | 2026/08/05 07:14 | tool | grepper |
0mArgs:{
"Expression": "config RISCV_SBI",
"PathPrefix": "arch/riscv"
}Results: {
"Output": "arch/riscv/Kconfig=278=config RISCV_M_MODE\n--\narch/riscv/Kconfig-286-# set if we are running in S-mode and can use SBI calls\narch/riscv/Kconfig:287:config RISCV_SBI\narch/riscv/Kconfig-288-\tbool\n--\narch/riscv/Kconfig=932=config RISCV_VECTOR_MISALIGNED\n--\narch/riscv/Kconfig-938-\narch/riscv/Kconfig:939:config RISCV_SBI_FWFT_DELEGATE_MISALIGNED\narch/riscv/Kconfig-940-\tbool \"Request firmware delegation of unaligned access exceptions\"\n--\narch/riscv/Kconfig=1057=source \"kernel/Kconfig.hz\"\narch/riscv/Kconfig-1058-\narch/riscv/Kconfig:1059:config RISCV_SBI_V01\narch/riscv/Kconfig-1060-\tbool \"SBI v0.1 support\"\n"
} |
| 11/2 | 2026/08/05 07:14 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 8826 output: 29 thoughts: 30 Thoughts: Here's my summary, as though I'm thinking through this process: **Investigating the RISCV_SBI Macro** Okay, so `RISCV_SBI`... that's a macro, likely a boolean, and based on the naming convention it seems like it's probably *enabled* by default, unless something else explicitly sets it to false. The "hidden" bit tells me it's not directly exposed as a configuration option, which means it’s most likely controlled through some dependency or a more global build setting. Time to trace its definition and see what's actually driving its selection. Where is this thing being *set*? I need to find the conditional logic that makes this thing true or false. Gotta find the root cause. |
| 12/2 | 2026/08/05 07:14 | tool | grepper |
0mArgs:{
"Expression": "select RISCV_SBI",
"PathPrefix": "arch/riscv"
}Results: {
"Output": "arch/riscv/Kconfig=1181=config RISCV_USER_CFI\n--\narch/riscv/Kconfig-1186-\tdepends on RISCV_ALTERNATIVE\narch/riscv/Kconfig:1187:\tselect RISCV_SBI\narch/riscv/Kconfig-1188-\tselect ARCH_HAS_USER_SHADOW_STACK\n--\narch/riscv/Kconfig.socs=87=config ARCH_VIRT\n--\narch/riscv/Kconfig.socs-95-\tselect PM_GENERIC_DOMAINS_OF if PM \u0026\u0026 OF\narch/riscv/Kconfig.socs:96:\tselect RISCV_SBI_CPUIDLE if CPU_IDLE \u0026\u0026 RISCV_SBI\narch/riscv/Kconfig.socs-97-\thelp\n"
} |
| 13/2 | 2026/08/05 07:14 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 9253 output: 35 thoughts: 70 Thoughts: **Examining the RISCV_SBI Configuration** Okay, so I see `RISCV_SBI` defined here. Right, let's just make absolutely certain I understand this. It says it's set if we're running in S-mode and can use SBI calls. That makes sense, a standard Supervisory Binary Interface. But let me quickly double-check the configuration itself. Ah, I see, it's a `bool`, depending on the negation of `RISCV_M_MODE` and defaulting to 'y'. That dependency on `!RISCV_M_MODE` is key. It's essentially saying, if we are *not* in machine mode, then we *can* use SBI calls. Good, that aligns with the expected architecture. No ambiguity there. I think I have a solid handle on what this configuration variable represents. |
| 14/2 | 2026/08/05 07:14 | tool | read-file |
0mArgs:{
"File": "arch/riscv/Kconfig",
"FirstLine": 280,
"LineCount": 20
}Results: {
"Contents": " 280:\t\tdepends on !MMU\n 281:\t\tdefault y\n 282:\t\thelp\n 283:\t\t Select this option if you want to run the kernel in M-mode,\n 284:\t\t without the assistance of any other firmware.\n 285:\t\n 286:\t# set if we are running in S-mode and can use SBI calls\n 287:\tconfig RISCV_SBI\n 288:\t\tbool\n 289:\t\tdepends on !RISCV_M_MODE\n 290:\t\tdefault y\n 291:\t\n 292:\tconfig MMU\n 293:\t\tbool \"MMU-based Paged Memory Management Support\"\n 294:\t\tdefault y\n 295:\t\thelp\n 296:\t\t Select if you want MMU-based virtualised addressing space\n 297:\t\t support by paged memory management. If unsure, say 'Y'.\n 298:\t\n 299:\tconfig KASAN_SHADOW_OFFSET\n"
} |
| 15/2 | 2026/08/05 07:14 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 9810 output: 43 thoughts: 158 Thoughts: **Analyzing Kernel Configuration Requirements** Okay, so I'm looking at these kernel configurations and trying to figure out the minimal set we need to focus on. It looks like `RISCV_SBI` and `MMU` are already set to 'y' by default, which is convenient. That means the real critical configurations for this change are likely just `KVM` and `VIRTUALIZATION`. Now, let's double-check if there are any other potential dependencies or gotchas. The commit message directly references `CONFIG_KVM`, which is promising. The message specifically notes that the command-line parameter for this feature is only active if `KVM` is built *into* the kernel, i.e., `CONFIG_KVM=y`; if it's a module, (`CONFIG_KVM=m`) the default behavior will be used, which is a trap. Since Syzkaller builds everything as 'y' by default, and this commit depends on `CONFIG_KVM=y`, this seems like the correct configuration. Let's double check `kvm_arch_vcpu_ioctl_run`. |
| 16/2 | 2026/08/05 07:14 | tool | grepper |
0mArgs:{
"Expression": "kvm_arch_vcpu_ioctl_run",
"PathPrefix": "arch/riscv/kvm/vcpu.c"
}Results: {
"Output": "arch/riscv/kvm/vcpu.c=814=static void noinstr kvm_riscv_vcpu_enter_exit(struct kvm_vcpu *vcpu,\n--\narch/riscv/kvm/vcpu.c-823-\t * HTINST) here because we do local_irq_enable() after this\narch/riscv/kvm/vcpu.c:824:\t * function in kvm_arch_vcpu_ioctl_run() which can result in\narch/riscv/kvm/vcpu.c-825-\t * an interrupt immediately after local_irq_enable() and can\n--\narch/riscv/kvm/vcpu.c-893-\narch/riscv/kvm/vcpu.c:894:int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)\narch/riscv/kvm/vcpu.c-895-{\n"
} |
| 17/2 | 2026/08/05 07:14 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 10496 output: 139 thoughts: 663 Thoughts: **Focusing on the Core KVM Execution Loop** Okay, so I've examined this patch, and the key function of interest is definitely `kvm_arch_vcpu_ioctl_run`. It's the only non-static function that's been modified, and importantly, it's the entry point for the `KVM_RUN` ioctl. This ioctl is the very core of KVM guest execution, so any changes here are critical. My reasoning is straightforward: this patch introduces a new WFI trap policy for RISC-V KVM guests. This policy is controlled by a kernel command-line parameter, which is standard practice. The change itself modifies the main execution loop within `kvm_arch_vcpu_ioctl_run`. Specifically, it re-evaluates the WFI trap policy, which then updates `HSTATUS.VTW`, right before each guest entry. This means the host won't have the wrong impression about a WFI that it can allow. I checked the code again, focusing on the added static functions `kvm_riscv_vcpu_wfi_should_trap` and `kvm_riscv_vcpu_update_wfi_trap`, but they're just support functions. The critical functional change lies *within* the loop in `kvm_arch_vcpu_ioctl_run`. This is not just theoretical; we can test it directly in a virtualized RISC-V environment. Thus, including `kvm_arch_vcpu_ioctl_run` in my focus symbols makes complete sense. I'll make sure to get this into set-results. |
| 18/2 | 2026/08/05 07:14 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"KVM",
"VIRTUALIZATION"
],
"FocusSymbols": [
"kvm_arch_vcpu_ioctl_run"
],
"Reasoning": "The patch introduces a new WFI trap policy for RISC-V KVM guests, controlled by a kernel command-line parameter. It modifies the `kvm_arch_vcpu_ioctl_run` loop to re-evaluate the trap policy before each guest entry. This is a functional change to the core KVM execution loop on RISC-V and can be reached and tested in virtualized environments.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"KVM",
"VIRTUALIZATION"
],
"FocusSymbols": [
"kvm_arch_vcpu_ioctl_run"
],
"Reasoning": "The patch introduces a new WFI trap policy for RISC-V KVM guests, controlled by a kernel command-line parameter. It modifies the `kvm_arch_vcpu_ioctl_run` loop to re-evaluate the trap policy before each guest entry. This is a functional change to the core KVM execution loop on RISC-V and can be reached and tested in virtualized environments.",
"WorthFuzzing": true
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|