AI Trajectory


Trajectory: (Expand/Collapse All)
Seq Timestamp Type Name Duration
0/0 2026/10/29 08:19 flow patch-triage
2m Args:
null

Results:
{
  "EnableConfigs": [
    "KVM",
    "KVM_INTEL",
    "KVM_AMD",
    "KVM_HYPERV",
    "KVM_IOAPIC",
    "KVM_AMD_SEV",
    "PROVE_LOCKING"
  ],
  "FocusSymbols": [
    "cancel_hv_timer",
    "start_hv_timer",
    "start_sw_timer",
    "kvm_lapic_expired_hv_timer",
    "kvm_lapic_restart_hv_timer",
    "hv_tlb_flush_enqueue",
    "enter_svm_guest_mode",
    "svm_set_vintr",
    "svm_clear_vintr",
    "alloc_shadow_vmcs",
    "copy_shadow_to_vmcs12",
    "copy_vmcs12_to_shadow",
    "nested_vmx_restore_host_state",
    "pi_enable_wakeup_handler",
    "kvm_arch_irq_bypass_del_producer"
  ],
  "KMSANReasoning": "The patch series performs a systematic refactoring across x86 KVM code to replace unconditional warning macros (WARN_ON, WARN) with one-shot variants (WARN_ON_ONCE, WARN_ONCE) to prevent log flooding on assertion failures, and replaces WARN_ON(preemptible()) checks with lockdep_assert_preemption_disabled().\n\nNo memory allocation, deallocation, copying to user space, or data initialization logic is introduced or altered. There are no changes to control flow depending on uninitialized data, nor any new or modified data structures. The side effects within the evaluated conditions (such as kfifo_in()) remain evaluated on every call, identical to their previous behavior under WARN_ON.\n\nBecause these changes do not create, access, or expose uninitialized memory or information leaks to userspace, KMSAN is not applicable. Any potential concurrency or locking issues are handled by standard LOCKDEP / KASAN builds. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
  "NeedsKMSAN": false,
  "Reasoning": "The patch updates runtime assertions across arch/x86/kvm (including LAPIC, nested SVM/VMX, PIT, Hyper-V emulation, TDP MMU, and IRQ handling), converting multiple WARN_ON checks to WARN_ON_ONCE and replacing preemptible checks with lockdep_assert_preemption_disabled(). KVM is fully reachable and fuzzable via /dev/kvm ioctls and guest execution on amd64 in virtualized environments. Modifying assertions and preemption invariants in reachable core subsystem code warrants fuzzing to detect if any sequence of operations can trigger them.",
  "WorthFuzzing": true
}

1/1 2026/10/29 08:19 action read-patch-diff
0m Args:
null

Results:
{
  "PatchDiff": "commit 5ad32865239365715bdc4fe064d55fd1494ae8be\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate:   Thu Oct 29 08:19:33 2026 +0000\n\n    syz-cluster: applied patch under review\n\ndiff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c\nindex 5d2e3617c95200..d9e3d49a6cc5e1 100644\n--- a/arch/x86/kvm/hyperv.c\n+++ b/arch/x86/kvm/hyperv.c\n@@ -1977,7 +1977,7 @@ static void hv_tlb_flush_enqueue(struct kvm_vcpu *vcpu, u64 *entries, int count,\n \t * space, just put 'flush all' entry there.\n \t */\n \tif (count \u0026\u0026 entries \u0026\u0026 count \u003c kfifo_avail(\u0026tlb_flush_fifo-\u003eentries)) {\n-\t\tWARN_ON(kfifo_in(\u0026tlb_flush_fifo-\u003eentries, entries, count) != count);\n+\t\tWARN_ON_ONCE(kfifo_in(\u0026tlb_flush_fifo-\u003eentries, entries, count) != count);\n \t\tgoto out_unlock;\n \t}\n \ndiff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c\nindex 1982b0077ddda9..7ad8c11a1809d7 100644\n--- a/arch/x86/kvm/i8254.c\n+++ b/arch/x86/kvm/i8254.c\n@@ -409,7 +409,7 @@ static void kvm_pit_load_count(struct kvm_pit *pit, int channel, u32 val,\n \n \tif (hpet_legacy_start) {\n \t\t/* save existing mode for later reenablement */\n-\t\tWARN_ON(channel != 0);\n+\t\tWARN_ON_ONCE(channel != 0);\n \t\tsaved_mode = pit-\u003epit_state.channels[0].mode;\n \t\tpit-\u003epit_state.channels[0].mode = 0xff; /* disable timer */\n \t\tpit_load_count(pit, channel, val);\ndiff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c\nindex 8719772882722d..7f8b092b447950 100644\n--- a/arch/x86/kvm/irq.c\n+++ b/arch/x86/kvm/irq.c\n@@ -128,7 +128,7 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_cpu_has_interrupt);\n int kvm_cpu_get_extint(struct kvm_vcpu *v)\n {\n \tif (!kvm_cpu_has_extint(v)) {\n-\t\tWARN_ON(!lapic_in_kernel(v));\n+\t\tWARN_ON_ONCE(!lapic_in_kernel(v));\n \t\treturn -1;\n \t}\n \n@@ -513,7 +513,7 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,\n \tstruct kvm *kvm = irqfd-\u003ekvm;\n \tint ret;\n \n-\tWARN_ON(irqfd-\u003eproducer != prod);\n+\tWARN_ON_ONCE(irqfd-\u003eproducer != prod);\n \n \t/*\n \t * If the producer of an IRQ that is currently being posted to a vCPU\ndiff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c\nindex ecf611845fb12d..08b96b124b07ee 100644\n--- a/arch/x86/kvm/lapic.c\n+++ b/arch/x86/kvm/lapic.c\n@@ -2062,7 +2062,7 @@ static void apic_timer_expired(struct kvm_lapic *apic, bool from_timer_fn)\n \t\tktimer-\u003eexpired_tscdeadline = ktimer-\u003etscdeadline;\n \n \tif (!from_timer_fn \u0026\u0026 apic-\u003eapicv_active \u0026\u0026 vcpu-\u003ewants_to_run) {\n-\t\tWARN_ON(kvm_get_running_vcpu() != vcpu);\n+\t\tWARN_ON_ONCE(kvm_get_running_vcpu() != vcpu);\n \t\tkvm_apic_inject_pending_timer_irqs(apic);\n \t\treturn;\n \t}\n@@ -2270,8 +2270,9 @@ bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu)\n \n static void cancel_hv_timer(struct kvm_lapic *apic)\n {\n-\tWARN_ON(preemptible());\n-\tWARN_ON(!apic-\u003elapic_timer.hv_timer_in_use);\n+\tlockdep_assert_preemption_disabled();\n+\n+\tWARN_ON_ONCE(!apic-\u003elapic_timer.hv_timer_in_use);\n \tkvm_x86_call(cancel_hv_timer)(apic-\u003evcpu);\n \tapic-\u003elapic_timer.hv_timer_in_use = false;\n }\n@@ -2282,7 +2283,8 @@ static bool start_hv_timer(struct kvm_lapic *apic)\n \tstruct kvm_vcpu *vcpu = apic-\u003evcpu;\n \tbool expired;\n \n-\tWARN_ON(preemptible());\n+\tlockdep_assert_preemption_disabled();\n+\n \tif (!kvm_can_use_hv_timer(vcpu))\n \t\treturn false;\n \n@@ -2322,7 +2324,8 @@ static void start_sw_timer(struct kvm_lapic *apic)\n {\n \tstruct kvm_timer *ktimer = \u0026apic-\u003elapic_timer;\n \n-\tWARN_ON(preemptible());\n+\tlockdep_assert_preemption_disabled();\n+\n \tif (apic-\u003elapic_timer.hv_timer_in_use)\n \t\tcancel_hv_timer(apic);\n \tif (!apic_lvtt_period(apic) \u0026\u0026 atomic_read(\u0026ktimer-\u003epending))\n@@ -2356,7 +2359,7 @@ void kvm_lapic_expired_hv_timer(struct kvm_vcpu *vcpu)\n \t/* If the preempt notifier has already run, it also called apic_timer_expired */\n \tif (!apic-\u003elapic_timer.hv_timer_in_use)\n \t\tgoto out;\n-\tWARN_ON(kvm_vcpu_is_blocking(vcpu));\n+\tWARN_ON_ONCE(kvm_vcpu_is_blocking(vcpu));\n \tapic_timer_expired(apic, false);\n \tcancel_hv_timer(apic);\n \n@@ -2389,7 +2392,7 @@ void kvm_lapic_restart_hv_timer(struct kvm_vcpu *vcpu)\n {\n \tstruct kvm_lapic *apic = vcpu-\u003earch.apic;\n \n-\tWARN_ON(!apic-\u003elapic_timer.hv_timer_in_use);\n+\tWARN_ON_ONCE(!apic-\u003elapic_timer.hv_timer_in_use);\n \trestart_apic_timer(apic);\n }\n \ndiff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c\nindex 44dad106fad191..9169d8dbe43c38 100644\n--- a/arch/x86/kvm/mmu/tdp_mmu.c\n+++ b/arch/x86/kvm/mmu/tdp_mmu.c\n@@ -43,7 +43,7 @@ void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm)\n #ifdef CONFIG_KVM_PROVE_MMU\n \tKVM_MMU_WARN_ON(atomic64_read(\u0026kvm-\u003earch.tdp_mmu_pages));\n #endif\n-\tWARN_ON(!list_empty(\u0026kvm-\u003earch.tdp_mmu_roots));\n+\tWARN_ON_ONCE(!list_empty(\u0026kvm-\u003earch.tdp_mmu_roots));\n \n \t/*\n \t * Ensure that all the outstanding RCU callbacks to free shadow pages\n@@ -1368,7 +1368,7 @@ static bool __kvm_tdp_mmu_age_gfn_range(struct kvm *kvm,\n \t * this helper must NOT be used to unmap GFNs, as it processes only\n \t * valid roots!\n \t */\n-\tWARN_ON(types \u0026 ~KVM_VALID_ROOTS);\n+\tWARN_ON_ONCE(types \u0026 ~KVM_VALID_ROOTS);\n \n \tguard(rcu)();\n \tfor_each_tdp_mmu_root_rcu(kvm, root, range-\u003eslot-\u003eas_id, types) {\ndiff --git a/arch/x86/kvm/msrs.c b/arch/x86/kvm/msrs.c\nindex e91650af44c207..b8ab784704faa2 100644\n--- a/arch/x86/kvm/msrs.c\n+++ b/arch/x86/kvm/msrs.c\n@@ -643,7 +643,7 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info)\n \n \tr = kvm_x86_call(set_efer)(vcpu, efer);\n \tif (r) {\n-\t\tWARN_ON(r \u003e 0);\n+\t\tWARN_ON_ONCE(r \u003e 0);\n \t\treturn r;\n \t}\n \ndiff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c\nindex 3b037e3855234e..0042039e15e3f8 100644\n--- a/arch/x86/kvm/svm/avic.c\n+++ b/arch/x86/kvm/svm/avic.c\n@@ -1042,7 +1042,7 @@ static void __avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu,\n \n \tlockdep_assert_preemption_disabled();\n \n-\tif (WARN_ON(h_physical_id \u0026 ~AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK))\n+\tif (WARN_ON_ONCE(h_physical_id \u0026 ~AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK))\n \t\treturn;\n \n \tif (WARN_ON_ONCE(vcpu-\u003evcpu_id * sizeof(entry) \u003e=\ndiff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c\nindex af0ef678433d72..ab66f07337b5b2 100644\n--- a/arch/x86/kvm/svm/nested.c\n+++ b/arch/x86/kvm/svm/nested.c\n@@ -100,7 +100,7 @@ static void nested_svm_init_mmu_context(struct kvm_vcpu *vcpu)\n {\n \tstruct vcpu_svm *svm = to_svm(vcpu);\n \n-\tWARN_ON(mmu_is_nested(vcpu));\n+\tWARN_ON_ONCE(mmu_is_nested(vcpu));\n \n \tvcpu-\u003earch.mmu = \u0026vcpu-\u003earch.guest_mmu;\n \n@@ -260,7 +260,7 @@ int __init nested_svm_init_msrpm_merge_offsets(void)\n \t\tint bit_nr = svm_msrpm_bit_nr(merge_msrs[i]);\n \t\tu32 offset;\n \n-\t\tif (WARN_ON(bit_nr \u003c 0))\n+\t\tif (WARN_ON_ONCE(bit_nr \u003c 0))\n \t\t\treturn -EIO;\n \n \t\t/*\n@@ -277,7 +277,7 @@ int __init nested_svm_init_msrpm_merge_offsets(void)\n \t\tif (j \u003c nested_svm_nr_msrpm_merge_offsets)\n \t\t\tcontinue;\n \n-\t\tif (WARN_ON(j \u003e= ARRAY_SIZE(nested_svm_msrpm_merge_offsets)))\n+\t\tif (WARN_ON_ONCE(j \u003e= ARRAY_SIZE(nested_svm_msrpm_merge_offsets)))\n \t\t\treturn -EIO;\n \n \t\tnested_svm_msrpm_merge_offsets[j] = offset;\n@@ -1065,7 +1065,7 @@ int enter_svm_guest_mode(struct kvm_vcpu *vcpu, u64 vmcb12_gpa, bool from_vmrun)\n \n \tsvm-\u003enested.vmcb12_gpa = vmcb12_gpa;\n \n-\tWARN_ON(svm-\u003evmcb == svm-\u003enested.vmcb02.ptr);\n+\tWARN_ON_ONCE(svm-\u003evmcb == svm-\u003enested.vmcb02.ptr);\n \n \tnested_svm_copy_common_state(svm-\u003evmcb01.ptr, svm-\u003enested.vmcb02.ptr);\n \n@@ -1716,7 +1716,7 @@ static void nested_svm_inject_exception_vmexit(struct kvm_vcpu *vcpu)\n \t\t\tkvm_update_dr7(vcpu);\n \t\t}\n \t} else {\n-\t\tWARN_ON(ex-\u003ehas_payload);\n+\t\tWARN_ON_ONCE(ex-\u003ehas_payload);\n \t}\n \n \tnested_svm_vmexit(svm);\n@@ -2123,7 +2123,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,\n \n static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu)\n {\n-\tif (WARN_ON(!is_guest_mode(vcpu)))\n+\tif (WARN_ON_ONCE(!is_guest_mode(vcpu)))\n \t\treturn true;\n \n \tif (is_pae_paging(vcpu)) {\ndiff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c\nindex 6427db390b1cd2..8cd0f153982902 100644\n--- a/arch/x86/kvm/svm/sev.c\n+++ b/arch/x86/kvm/svm/sev.c\n@@ -3007,7 +3007,7 @@ void sev_vm_destroy(struct kvm *kvm)\n \tif (!sev_guest(kvm))\n \t\treturn;\n \n-\tWARN_ON(!list_empty(\u0026sev-\u003emirror_vms));\n+\tWARN_ON_ONCE(!list_empty(\u0026sev-\u003emirror_vms));\n \n \t/*\n \t * If this is a mirror VM, remove it from the owner's list of a mirrors\ndiff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c\nindex 487897ef11dd6c..c8e82debb7f457 100644\n--- a/arch/x86/kvm/svm/svm.c\n+++ b/arch/x86/kvm/svm/svm.c\n@@ -1598,7 +1598,7 @@ static void svm_set_vintr(struct vcpu_svm *svm)\n \t/*\n \t * The following fields are ignored when AVIC is enabled\n \t */\n-\tWARN_ON(kvm_vcpu_apicv_activated(\u0026svm-\u003evcpu));\n+\tWARN_ON_ONCE(kvm_vcpu_apicv_activated(\u0026svm-\u003evcpu));\n \n \tsvm_set_intercept(svm, INTERCEPT_VINTR);\n \n@@ -1633,8 +1633,8 @@ static void svm_clear_vintr(struct vcpu_svm *svm)\n \tif (is_guest_mode(\u0026svm-\u003evcpu)) {\n \t\tsvm-\u003evmcb01.ptr-\u003econtrol.int_ctl \u0026= ~V_IRQ_INJECTION_BITS_MASK;\n \n-\t\tWARN_ON((svm-\u003evmcb-\u003econtrol.int_ctl \u0026 V_TPR_MASK) !=\n-\t\t\t(svm-\u003enested.ctl.int_ctl \u0026 V_TPR_MASK));\n+\t\tWARN_ON_ONCE((svm-\u003evmcb-\u003econtrol.int_ctl \u0026 V_TPR_MASK) !=\n+\t\t\t     (svm-\u003enested.ctl.int_ctl \u0026 V_TPR_MASK));\n \n \t\tsvm-\u003evmcb-\u003econtrol.int_ctl |= svm-\u003enested.ctl.int_ctl \u0026\n \t\t\tV_IRQ_INJECTION_BITS_MASK;\n@@ -2666,7 +2666,7 @@ static int cr_interception(struct kvm_vcpu *vcpu)\n \t\t\terr = kvm_set_cr8(vcpu, val);\n \t\t\tbreak;\n \t\tdefault:\n-\t\t\tWARN(1, \"unhandled write to CR%d\", cr);\n+\t\t\tWARN_ONCE(1, \"unhandled write to CR%d\", cr);\n \t\t\tkvm_queue_exception(vcpu, UD_VECTOR);\n \t\t\treturn 1;\n \t\t}\n@@ -2688,7 +2688,7 @@ static int cr_interception(struct kvm_vcpu *vcpu)\n \t\t\tval = kvm_get_cr8(vcpu);\n \t\t\tbreak;\n \t\tdefault:\n-\t\t\tWARN(1, \"unhandled read from CR%d\", cr);\n+\t\t\tWARN_ONCE(1, \"unhandled read from CR%d\", cr);\n \t\t\tkvm_queue_exception(vcpu, UD_VECTOR);\n \t\t\treturn 1;\n \t\t}\n@@ -2725,7 +2725,7 @@ static int cr_trap(struct kvm_vcpu *vcpu)\n \t\tret = kvm_set_cr8(vcpu, new_value);\n \t\tbreak;\n \tdefault:\n-\t\tWARN(1, \"unhandled CR%d write trap\", cr);\n+\t\tWARN_ONCE(1, \"unhandled CR%d write trap\", cr);\n \t\tkvm_queue_exception(vcpu, UD_VECTOR);\n \t\treturn 1;\n \t}\ndiff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c\nindex 9b0bfa2f854cf9..ec3bc441a0e68f 100644\n--- a/arch/x86/kvm/vmx/nested.c\n+++ b/arch/x86/kvm/vmx/nested.c\n@@ -515,7 +515,7 @@ static void nested_ept_new_eptp(struct kvm_vcpu *vcpu)\n \n static void nested_ept_init_mmu_context(struct kvm_vcpu *vcpu)\n {\n-\tWARN_ON(mmu_is_nested(vcpu));\n+\tWARN_ON_ONCE(mmu_is_nested(vcpu));\n \n \tvcpu-\u003earch.mmu = \u0026vcpu-\u003earch.guest_mmu;\n \tnested_ept_new_eptp(vcpu);\n@@ -1315,7 +1315,7 @@ static void nested_vmx_transition_tlb_flush(struct kvm_vcpu *vcpu,\n \t}\n \n \t/* L2 should never have a VPID if VPID is disabled. */\n-\tWARN_ON(!enable_vpid);\n+\tWARN_ON_ONCE(!enable_vpid);\n \n \t/*\n \t * VPID is enabled and in use by vmcs12.  If vpid12 is changing, then\n@@ -1698,7 +1698,7 @@ static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx)\n \tunsigned long val;\n \tint i;\n \n-\tif (WARN_ON(!shadow_vmcs))\n+\tif (WARN_ON_ONCE(!shadow_vmcs))\n \t\treturn;\n \n \tpreempt_disable();\n@@ -1733,7 +1733,7 @@ static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx)\n \tunsigned long val;\n \tint i, q;\n \n-\tif (WARN_ON(!shadow_vmcs))\n+\tif (WARN_ON_ONCE(!shadow_vmcs))\n \t\treturn;\n \n \tvmcs_load(shadow_vmcs);\n@@ -4978,7 +4978,7 @@ static void nested_vmx_restore_host_state(struct kvm_vcpu *vcpu)\n \t\tif (vcpu-\u003eguest_debug \u0026 KVM_GUESTDBG_USE_HW_BP)\n \t\t\tkvm_set_dr(vcpu, 7, DR7_FIXED_1);\n \t\telse\n-\t\t\tWARN_ON(kvm_set_dr(vcpu, 7, vmcs_readl(GUEST_DR7)));\n+\t\t\tWARN_ON_ONCE(kvm_set_dr(vcpu, 7, vmcs_readl(GUEST_DR7)));\n \t}\n \n \t/* Reload DEBUGCTL to ensure vmcs01 has a fresh FREEZE_IN_SMM value. */\n@@ -5408,7 +5408,7 @@ static struct vmcs *alloc_shadow_vmcs(struct kvm_vcpu *vcpu)\n \t * doesn't support virtualization of VMCS shadowing, so vmcs01 should\n \t * always be the loaded VMCS.\n \t */\n-\tif (WARN_ON(loaded_vmcs != \u0026vmx-\u003evmcs01 || loaded_vmcs-\u003eshadow_vmcs))\n+\tif (WARN_ON_ONCE(loaded_vmcs != \u0026vmx-\u003evmcs01 || loaded_vmcs-\u003eshadow_vmcs))\n \t\treturn loaded_vmcs-\u003eshadow_vmcs;\n \n \tloaded_vmcs-\u003eshadow_vmcs = alloc_vmcs(true);\ndiff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c\nindex 2644add54b76bc..0f508015692b4f 100644\n--- a/arch/x86/kvm/vmx/posted_intr.c\n+++ b/arch/x86/kvm/vmx/posted_intr.c\n@@ -187,7 +187,7 @@ static void pi_enable_wakeup_handler(struct kvm_vcpu *vcpu)\n \t\t      \u0026per_cpu(wakeup_vcpus_on_cpu, vcpu-\u003ecpu));\n \traw_spin_unlock(\u0026per_cpu(wakeup_vcpus_on_cpu_lock, vcpu-\u003ecpu));\n \n-\tWARN(pi_test_sn(pi_desc), \"PI descriptor SN field set before blocking\");\n+\tWARN_ONCE(pi_test_sn(pi_desc), \"PI descriptor SN field set before blocking\");\n \n \told.control = READ_ONCE(pi_desc-\u003econtrol);\n \tdo {\ndiff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c\nindex b341af4c6057a7..0038626f54868d 100644\n--- a/arch/x86/kvm/vmx/vmx.c\n+++ b/arch/x86/kvm/vmx/vmx.c\n@@ -3089,7 +3089,7 @@ void free_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)\n \tloaded_vmcs-\u003evmcs = NULL;\n \tif (loaded_vmcs-\u003emsr_bitmap)\n \t\tfree_page((unsigned long)loaded_vmcs-\u003emsr_bitmap);\n-\tWARN_ON(loaded_vmcs-\u003eshadow_vmcs != NULL);\n+\tWARN_ON_ONCE(loaded_vmcs-\u003eshadow_vmcs != NULL);\n }\n \n int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)\n@@ -4468,7 +4468,7 @@ void vmx_set_constant_host_state(struct vcpu_vmx *vmx)\n \tunsigned long cr0, cr3, cr4;\n \n \tcr0 = read_cr0();\n-\tWARN_ON(cr0 \u0026 X86_CR0_TS);\n+\tWARN_ON_ONCE(cr0 \u0026 X86_CR0_TS);\n \tvmcs_writel(HOST_CR0, cr0);  /* 22.2.3 */\n \n \t/*\n@@ -5537,7 +5537,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu)\n \t\t\t * STI and MOVSS blocking.\n \t\t\t */\n \t\t\tif (is_icebp(intr_info))\n-\t\t\t\tWARN_ON(!skip_emulated_instruction(vcpu));\n+\t\t\t\tWARN_ON_ONCE(!skip_emulated_instruction(vcpu));\n \n \t\t\tkvm_queue_exception_p(vcpu, DB_VECTOR, dr6);\n \t\t\treturn 1;\n@@ -5962,7 +5962,7 @@ static int handle_task_switch(struct kvm_vcpu *vcpu)\n \tif (!idt_v || (type != INTR_TYPE_HARD_EXCEPTION \u0026\u0026\n \t\t       type != INTR_TYPE_EXT_INTR \u0026\u0026\n \t\t       type != INTR_TYPE_NMI_INTR))\n-\t\tWARN_ON(!skip_emulated_instruction(vcpu));\n+\t\tWARN_ON_ONCE(!skip_emulated_instruction(vcpu));\n \n \t/*\n \t * TODO: What about debug traps on tss switch?\ndiff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c\nindex 32563a91fba99a..a9be847d3cc2cc 100644\n--- a/arch/x86/kvm/x86.c\n+++ b/arch/x86/kvm/x86.c\n@@ -370,7 +370,7 @@ static int exception_type(int vector)\n {\n \tunsigned int mask;\n \n-\tif (WARN_ON(vector \u003e 31 || vector == NMI_VECTOR))\n+\tif (WARN_ON_ONCE(vector \u003e 31 || vector == NMI_VECTOR))\n \t\treturn EXCPT_INTERRUPT;\n \n \tmask = 1 \u003c\u003c vector;\n@@ -4907,7 +4907,7 @@ static int kvm_fetch_guest_virt(struct x86_emulate_ctxt *ctxt,\n \t\treturn X86EMUL_PROPAGATE_FAULT;\n \n \toffset = addr \u0026 (PAGE_SIZE-1);\n-\tif (WARN_ON(offset + bytes \u003e PAGE_SIZE))\n+\tif (WARN_ON_ONCE(offset + bytes \u003e PAGE_SIZE))\n \t\tbytes = (unsigned)PAGE_SIZE - offset;\n \tret = kvm_vcpu_read_guest_page(vcpu, gpa \u003e\u003e PAGE_SHIFT, val,\n \t\t\t\t       offset, bytes);\n@@ -5167,7 +5167,7 @@ static int emulator_read_write_onepage(unsigned long addr, void *val,\n \tbytes -= handled;\n \tval += handled;\n \n-\tWARN_ON(vcpu-\u003emmio_nr_fragments \u003e= KVM_MAX_MMIO_FRAGMENTS);\n+\tWARN_ON_ONCE(vcpu-\u003emmio_nr_fragments \u003e= KVM_MAX_MMIO_FRAGMENTS);\n \tfrag = \u0026vcpu-\u003emmio_fragments[vcpu-\u003emmio_nr_fragments++];\n \tfrag-\u003egpa = gpa;\n \tif (write \u0026\u0026 bytes \u003c= 8u) {\n@@ -7042,7 +7042,7 @@ static int kvm_x86_check_processor_compatibility(void)\n \t * compatible, i.e. KVM should never perform a compatibility check on\n \t * an offline CPU.\n \t */\n-\tWARN_ON(!cpu_online(cpu));\n+\tWARN_ON_ONCE(!cpu_online(cpu));\n \n \tif (__cr4_reserved_bits(cpu_has, c) !=\n \t    __cr4_reserved_bits(cpu_has, \u0026boot_cpu_data))\n@@ -7783,7 +7783,7 @@ static int kvm_check_and_inject_events(struct kvm_vcpu *vcpu,\n \t\t\tvcpu-\u003earch.nmi_injected = true;\n \t\t\tkvm_x86_call(inject_nmi)(vcpu);\n \t\t\tcan_inject = false;\n-\t\t\tWARN_ON(kvm_x86_call(nmi_allowed)(vcpu, true) \u003c 0);\n+\t\t\tWARN_ON_ONCE(kvm_x86_call(nmi_allowed)(vcpu, true) \u003c 0);\n \t\t}\n \t\tif (vcpu-\u003earch.nmi_pending)\n \t\t\tkvm_x86_call(enable_nmi_window)(vcpu);\n@@ -7800,7 +7800,7 @@ static int kvm_check_and_inject_events(struct kvm_vcpu *vcpu,\n \t\t\tif (likely(irq != -1)) {\n \t\t\t\tkvm_queue_interrupt(vcpu, irq, false);\n \t\t\t\tkvm_x86_call(inject_irq)(vcpu, false);\n-\t\t\t\tWARN_ON(kvm_x86_call(interrupt_allowed)(vcpu, true) \u003c 0);\n+\t\t\t\tWARN_ON_ONCE(kvm_x86_call(interrupt_allowed)(vcpu, true) \u003c 0);\n \t\t\t} else {\n \t\t\t\tkvm_warn_on_lost_irq(vcpu);\n \t\t\t}\n@@ -8470,8 +8470,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)\n \t * KVM_DEBUGREG_WONT_EXIT again.\n \t */\n \tif (unlikely(vcpu-\u003earch.switch_db_regs \u0026 KVM_DEBUGREG_WONT_EXIT)) {\n-\t\tWARN_ON(vcpu-\u003eguest_debug \u0026 KVM_GUESTDBG_USE_HW_BP);\n-\t\tWARN_ON(vcpu-\u003earch.switch_db_regs \u0026 KVM_DEBUGREG_AUTO_SWITCH);\n+\t\tWARN_ON_ONCE(vcpu-\u003eguest_debug \u0026 KVM_GUESTDBG_USE_HW_BP);\n+\t\tWARN_ON_ONCE(vcpu-\u003earch.switch_db_regs \u0026 KVM_DEBUGREG_AUTO_SWITCH);\n \t\tkvm_x86_call(sync_dirty_debug_regs)(vcpu);\n \t\tkvm_update_dr0123(vcpu);\n \t\tvcpu-\u003earch.dr6 |= kvm_get_dr6_fixed_1(vcpu);\n@@ -10038,7 +10038,7 @@ void __user * __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa,\n \n \tlockdep_assert_held(\u0026kvm-\u003eslots_lock);\n \n-\tif (WARN_ON(id \u003e= KVM_MEM_SLOTS_NUM))\n+\tif (WARN_ON_ONCE(id \u003e= KVM_MEM_SLOTS_NUM))\n \t\treturn ERR_PTR_USR(-EINVAL);\n \n \tslot = id_to_memslot(slots, id);\ndiff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h\nindex cfe96962a4e48d..99ba31aa5ef5bc 100644\n--- a/arch/x86/kvm/x86.h\n+++ b/arch/x86/kvm/x86.h\n@@ -348,7 +348,7 @@ static inline void adjust_tsc_offset_guest(struct kvm_vcpu *vcpu,\n static inline void adjust_tsc_offset_host(struct kvm_vcpu *vcpu, s64 adjustment)\n {\n \tif (vcpu-\u003earch.l1_tsc_scaling_ratio != kvm_caps.default_tsc_scaling_ratio)\n-\t\tWARN_ON(adjustment \u003c 0);\n+\t\tWARN_ON_ONCE(adjustment \u003c 0);\n \tadjustment = kvm_scale_tsc((u64) adjustment,\n \t\t\t\t   vcpu-\u003earch.l1_tsc_scaling_ratio);\n \tadjust_tsc_offset_guest(vcpu, adjustment);\n"
}

2/1 2026/10/29 08:19 agent patch-evaluator
2m Model:
core

Args:
null

Results:
{
  "EnableConfigs": [
    "KVM",
    "KVM_INTEL",
    "KVM_AMD",
    "KVM_HYPERV",
    "KVM_IOAPIC",
    "KVM_AMD_SEV",
    "PROVE_LOCKING"
  ],
  "FocusSymbols": [
    "cancel_hv_timer",
    "start_hv_timer",
    "start_sw_timer",
    "kvm_lapic_expired_hv_timer",
    "kvm_lapic_restart_hv_timer",
    "hv_tlb_flush_enqueue",
    "enter_svm_guest_mode",
    "svm_set_vintr",
    "svm_clear_vintr",
    "alloc_shadow_vmcs",
    "copy_shadow_to_vmcs12",
    "copy_vmcs12_to_shadow",
    "nested_vmx_restore_host_state",
    "pi_enable_wakeup_handler",
    "kvm_arch_irq_bypass_del_producer"
  ],
  "Reasoning": "The patch updates runtime assertions across arch/x86/kvm (including LAPIC, nested SVM/VMX, PIT, Hyper-V emulation, TDP MMU, and IRQ handling), converting multiple WARN_ON checks to WARN_ON_ONCE and replacing preemptible checks with lockdep_assert_preemption_disabled(). KVM is fully reachable and fuzzable via /dev/kvm ioctls and guest execution on amd64 in virtualized environments. Modifying assertions and preemption invariants in reachable core subsystem code warrants fuzzing to detect if any sequence of operations can trigger them.",
  "WorthFuzzing": true
}

Instruction:
You are an expert Linux kernel maintainer and security engineer.
Your job is to review a provided patch series and evaluate whether it warrants fuzzing with syzkaller.

IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in
your workspace. Do NOT rely on internal assumptions. You must actively use your code access
tools to inspect the actual source code, callers, and surrounding context.

================================================================================
1. CORE TRIAGE PHILOSOPHY
================================================================================
The goal of patch fuzzing is to discover crashes, regressions, exposed latent bugs,
and newly triggered assertions introduced by the patch series.

- REACHABILITY IS THE PRIMARY GATE:
  Fuzzing can only discover bugs in code that can actually execute in standard virtualized
  environments (GCE or QEMU, utilizing software-emulated devices like USB gadgets, netdev, tun/tap).
  If the modified code is structurally unreachable (see Section 2), it MUST NOT be fuzzed,
  regardless of whether it adds assertions or complex logic.

- DO NOT BLINDLY TRUST "NO FUNCTIONAL CHANGE" (NFCI) OR "REFACTORING" CLAIMS:
  Patch authors routinely label changes as "cleanups", "refactorings", or state
  "No functional change intended". Do NOT take these claims at face value.
  Code refactorings that rearrange logic, introduce helper functions, or alter state management
  in core subsystems frequently introduce subtle semantic shifts or uncover latent kernel bugs.
  If reachable executable code is modified or refactored, it MUST be fuzzed.

- NEW OR MODIFIED ASSERTIONS IN REACHABLE CODE MUST BE FUZZED:
  When a patch introduces or modifies runtime checks or assertions (e.g., WARN_ON*, VM_WARN_ON*,
  BUG_ON*, lockdep_assert*) in reachable code paths, it enforces new or stricter invariants.
  Even if the author believes the invariant always holds, fuzzing is essential to verify whether
  an unusual sequence of operations can violate it.

================================================================================
2. WHEN TO RETURN WorthFuzzing=false (NEGATIVE CRITERIA)
================================================================================
Return WorthFuzzing=false ONLY IF all modified code falls strictly into one or more of these categories:

- Non-kernel and non-executable changes:
  * Modifications to Documentation/, comments, or spelling fixes.
  * User-space directories, self-tests, samples, or scripts (e.g., tools/, samples/, scripts/, usr/)
    that do not affect the compiled kernel image (vmlinux) or kernel modules.
  * Purely decorative logging (e.g., message strings in pr_err, printk, dev_info) or tracepoints
    that do not alter control flow or data structures.
  * Build system or Kconfig changes that do not alter compiled C logic.
- Structurally unreachable hardware:
  * Vendor-specific PCIe switches, SmartNICs, or GPU drivers (e.g., mlxsw, pds_core, qed,
    ionic, amdgpu) requiring physical ASIC/PCIe cards not emulated in standard QEMU.
- Unreachable execution paths:
  * Driver teardown callbacks (.remove, .shutdown, pci_unregister_driver) executed only during
    physical PCI hot-unplug or manual sysfs driver unbinding.
  * Code paths exclusive to architectures other than the target architecture.

================================================================================
3. WHEN TO RETURN WorthFuzzing=true (POSITIVE CRITERIA)
================================================================================
Return WorthFuzzing=true whenever the patch touches reachable executable code, including:
- Core Subsystems:
  * Any logic modifications in memory management (mm/), synchronization/locking (kernel/locking/),
    BPF, scheduler, core networking, VFS, or syscall handling.
- Refactorings and Code Cleanups:
  * Any restructuring of reachable data structures, helper abstractions, or algorithm flows.
- Runtime Assertions and Defensive Checks:
  * Any introduction or alteration of assertions (WARN_ON*, VM_WARN_ON*, BUG_ON*, etc.) in reachable paths.
- Reachable Drivers and Protocols:
  * Drivers accessible via virtual buses (virtio, USB gadget, loopback, netlink, binder, sockets, etc.).

================================================================================
4. EXTRACTING FocusSymbols (PREVENTING DILUTION)
================================================================================
When WorthFuzzing=true, you must extract specific kernel functions into FocusSymbols to guide the fuzzer:

- AVOID UBIQUITOUS LIFECYCLE HOT-PATHS:
  Do NOT list generic, ubiquitous functions called by almost every program in the corpus
  (including, but not limited to: general memory allocators and deallocators, page fault
  and trap handlers, or core synchronization primitives; this is not an exhaustive list).
  Listing ubiquitous functions causes the fuzzer to classify thousands of unrelated tests as "focused",
  which severely dilutes fuzzing effort away from the actual changes.

- TARGET SPECIFIC FEATURE LOGIC AND ENTRYPOINTS:
  List functions that specifically implement the logic being added or altered, or direct API entrypoints
  for the subsystem feature under review.

- HANDLING STATIC INLINE FUNCTIONS IN HEADERS (.h):
  Compiler-inlined static functions (such as static inlines in mm/*.h or include/linux/*.h) lack
  distinct symbol addresses in vmlinux and cannot be targeted directly by symbol coverage filters.
  If the changes are primarily in static inline helpers, identify non-static, feature-specific caller
  functions in .c files that exercise them (avoiding ubiquitous lifecycle wrappers).

================================================================================
5. IDENTIFYING EnableConfigs
================================================================================
Identify any specific CONFIG_ options required to properly compile and reach the modified code:
- Inspect Kconfig files and #ifdef guards; do not make assumptions.
- Check "depends on" lines in Kconfig to include any non-standard parent subsystem configs needed.
- Strip any '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:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 5ad32865239365715bdc4fe064d55fd1494ae8be
Author: syz-cluster <triage@syzkaller.com>
Date:   Thu Oct 29 08:19:33 2026 +0000

    syz-cluster: applied patch under review

diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index 5d2e3617c95200..d9e3d49a6cc5e1 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -1977,7 +1977,7 @@ static void hv_tlb_flush_enqueue(struct kvm_vcpu *vcpu, u64 *entries, int count,
 	 * space, just put 'flush all' entry there.
 	 */
 	if (count && entries && count < kfifo_avail(&tlb_flush_fifo->entries)) {
-		WARN_ON(kfifo_in(&tlb_flush_fifo->entries, entries, count) != count);
+		WARN_ON_ONCE(kfifo_in(&tlb_flush_fifo->entries, entries, count) != count);
 		goto out_unlock;
 	}
 
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 1982b0077ddda9..7ad8c11a1809d7 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -409,7 +409,7 @@ static void kvm_pit_load_count(struct kvm_pit *pit, int channel, u32 val,
 
 	if (hpet_legacy_start) {
 		/* save existing mode for later reenablement */
-		WARN_ON(channel != 0);
+		WARN_ON_ONCE(channel != 0);
 		saved_mode = pit->pit_state.channels[0].mode;
 		pit->pit_state.channels[0].mode = 0xff; /* disable timer */
 		pit_load_count(pit, channel, val);
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 8719772882722d..7f8b092b447950 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -128,7 +128,7 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_cpu_has_interrupt);
 int kvm_cpu_get_extint(struct kvm_vcpu *v)
 {
 	if (!kvm_cpu_has_extint(v)) {
-		WARN_ON(!lapic_in_kernel(v));
+		WARN_ON_ONCE(!lapic_in_kernel(v));
 		return -1;
 	}
 
@@ -513,7 +513,7 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
 	struct kvm *kvm = irqfd->kvm;
 	int ret;
 
-	WARN_ON(irqfd->producer != prod);
+	WARN_ON_ONCE(irqfd->producer != prod);
 
 	/*
 	 * If the producer of an IRQ that is currently being posted to a vCPU
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index ecf611845fb12d..08b96b124b07ee 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -2062,7 +2062,7 @@ static void apic_timer_expired(struct kvm_lapic *apic, bool from_timer_fn)
 		ktimer->expired_tscdeadline = ktimer->tscdeadline;
 
 	if (!from_timer_fn && apic->apicv_active && vcpu->wants_to_run) {
-		WARN_ON(kvm_get_running_vcpu() != vcpu);
+		WARN_ON_ONCE(kvm_get_running_vcpu() != vcpu);
 		kvm_apic_inject_pending_timer_irqs(apic);
 		return;
 	}
@@ -2270,8 +2270,9 @@ bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu)
 
 static void cancel_hv_timer(struct kvm_lapic *apic)
 {
-	WARN_ON(preemptible());
-	WARN_ON(!apic->lapic_timer.hv_timer_in_use);
+	lockdep_assert_preemption_disabled();
+
+	WARN_ON_ONCE(!apic->lapic_timer.hv_timer_in_use);
 	kvm_x86_call(cancel_hv_timer)(apic->vcpu);
 	apic->lapic_timer.hv_timer_in_use = false;
 }
@@ -2282,7 +2283,8 @@ static bool start_hv_timer(struct kvm_lapic *apic)
 	struct kvm_vcpu *vcpu = apic->vcpu;
 	bool expired;
 
-	WARN_ON(preemptible());
+	lockdep_assert_preemption_disabled();
+
 	if (!kvm_can_use_hv_timer(vcpu))
 		return false;
 
@@ -2322,7 +2324,8 @@ static void start_sw_timer(struct kvm_lapic *apic)
 {
 	struct kvm_timer *ktimer = &apic->lapic_timer;
 
-	WARN_ON(preemptible());
+	lockdep_assert_preemption_disabled();
+
 	if (apic->lapic_timer.hv_timer_in_use)
 		cancel_hv_timer(apic);
 	if (!apic_lvtt_period(apic) && atomic_read(&ktimer->pending))
@@ -2356,7 +2359,7 @@ void kvm_lapic_expired_hv_timer(struct kvm_vcpu *vcpu)
 	/* If the preempt notifier has already run, it also called apic_timer_expired */
 	if (!apic->lapic_timer.hv_timer_in_use)
 		goto out;
-	WARN_ON(kvm_vcpu_is_blocking(vcpu));
+	WARN_ON_ONCE(kvm_vcpu_is_blocking(vcpu));
 	apic_timer_expired(apic, false);
 	cancel_hv_timer(apic);
 
@@ -2389,7 +2392,7 @@ void kvm_lapic_restart_hv_timer(struct kvm_vcpu *vcpu)
 {
 	struct kvm_lapic *apic = vcpu->arch.apic;
 
-	WARN_ON(!apic->lapic_timer.hv_timer_in_use);
+	WARN_ON_ONCE(!apic->lapic_timer.hv_timer_in_use);
 	restart_apic_timer(apic);
 }
 
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index 44dad106fad191..9169d8dbe43c38 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -43,7 +43,7 @@ void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm)
 #ifdef CONFIG_KVM_PROVE_MMU
 	KVM_MMU_WARN_ON(atomic64_read(&kvm->arch.tdp_mmu_pages));
 #endif
-	WARN_ON(!list_empty(&kvm->arch.tdp_mmu_roots));
+	WARN_ON_ONCE(!list_empty(&kvm->arch.tdp_mmu_roots));
 
 	/*
 	 * Ensure that all the outstanding RCU callbacks to free shadow pages
@@ -1368,7 +1368,7 @@ static bool __kvm_tdp_mmu_age_gfn_range(struct kvm *kvm,
 	 * this helper must NOT be used to unmap GFNs, as it processes only
 	 * valid roots!
 	 */
-	WARN_ON(types & ~KVM_VALID_ROOTS);
+	WARN_ON_ONCE(types & ~KVM_VALID_ROOTS);
 
 	guard(rcu)();
 	for_each_tdp_mmu_root_rcu(kvm, root, range->slot->as_id, types) {
diff --git a/arch/x86/kvm/msrs.c b/arch/x86/kvm/msrs.c
index e91650af44c207..b8ab784704faa2 100644
--- a/arch/x86/kvm/msrs.c
+++ b/arch/x86/kvm/msrs.c
@@ -643,7 +643,7 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 
 	r = kvm_x86_call(set_efer)(vcpu, efer);
 	if (r) {
-		WARN_ON(r > 0);
+		WARN_ON_ONCE(r > 0);
 		return r;
 	}
 
diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index 3b037e3855234e..0042039e15e3f8 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -1042,7 +1042,7 @@ static void __avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu,
 
 	lockdep_assert_preemption_disabled();
 
-	if (WARN_ON(h_physical_id & ~AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK))
+	if (WARN_ON_ONCE(h_physical_id & ~AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK))
 		return;
 
 	if (WARN_ON_ONCE(vcpu->vcpu_id * sizeof(entry) >=
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index af0ef678433d72..ab66f07337b5b2 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -100,7 +100,7 @@ static void nested_svm_init_mmu_context(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 
-	WARN_ON(mmu_is_nested(vcpu));
+	WARN_ON_ONCE(mmu_is_nested(vcpu));
 
 	vcpu->arch.mmu = &vcpu->arch.guest_mmu;
 
@@ -260,7 +260,7 @@ int __init nested_svm_init_msrpm_merge_offsets(void)
 		int bit_nr = svm_msrpm_bit_nr(merge_msrs[i]);
 		u32 offset;
 
-		if (WARN_ON(bit_nr < 0))
+		if (WARN_ON_ONCE(bit_nr < 0))
 			return -EIO;
 
 		/*
@@ -277,7 +277,7 @@ int __init nested_svm_init_msrpm_merge_offsets(void)
 		if (j < nested_svm_nr_msrpm_merge_offsets)
 			continue;
 
-		if (WARN_ON(j >= ARRAY_SIZE(nested_svm_msrpm_merge_offsets)))
+		if (WARN_ON_ONCE(j >= ARRAY_SIZE(nested_svm_msrpm_merge_offsets)))
 			return -EIO;
 
 		nested_svm_msrpm_merge_offsets[j] = offset;
@@ -1065,7 +1065,7 @@ int enter_svm_guest_mode(struct kvm_vcpu *vcpu, u64 vmcb12_gpa, bool from_vmrun)
 
 	svm->nested.vmcb12_gpa = vmcb12_gpa;
 
-	WARN_ON(svm->vmcb == svm->nested.vmcb02.ptr);
+	WARN_ON_ONCE(svm->vmcb == svm->nested.vmcb02.ptr);
 
 	nested_svm_copy_common_state(svm->vmcb01.ptr, svm->nested.vmcb02.ptr);
 
@@ -1716,7 +1716,7 @@ static void nested_svm_inject_exception_vmexit(struct kvm_vcpu *vcpu)
 			kvm_update_dr7(vcpu);
 		}
 	} else {
-		WARN_ON(ex->has_payload);
+		WARN_ON_ONCE(ex->has_payload);
 	}
 
 	nested_svm_vmexit(svm);
@@ -2123,7 +2123,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
 
 static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu)
 {
-	if (WARN_ON(!is_guest_mode(vcpu)))
+	if (WARN_ON_ONCE(!is_guest_mode(vcpu)))
 		return true;
 
 	if (is_pae_paging(vcpu)) {
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index 6427db390b1cd2..8cd0f153982902 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -3007,7 +3007,7 @@ void sev_vm_destroy(struct kvm *kvm)
 	if (!sev_guest(kvm))
 		return;
 
-	WARN_ON(!list_empty(&sev->mirror_vms));
+	WARN_ON_ONCE(!list_empty(&sev->mirror_vms));
 
 	/*
 	 * If this is a mirror VM, remove it from the owner's list of a mirrors
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 487897ef11dd6c..c8e82debb7f457 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -1598,7 +1598,7 @@ static void svm_set_vintr(struct vcpu_svm *svm)
 	/*
 	 * The following fields are ignored when AVIC is enabled
 	 */
-	WARN_ON(kvm_vcpu_apicv_activated(&svm->vcpu));
+	WARN_ON_ONCE(kvm_vcpu_apicv_activated(&svm->vcpu));
 
 	svm_set_intercept(svm, INTERCEPT_VINTR);
 
@@ -1633,8 +1633,8 @@ static void svm_clear_vintr(struct vcpu_svm *svm)
 	if (is_guest_mode(&svm->vcpu)) {
 		svm->vmcb01.ptr->control.int_ctl &= ~V_IRQ_INJECTION_BITS_MASK;
 
-		WARN_ON((svm->vmcb->control.int_ctl & V_TPR_MASK) !=
-			(svm->nested.ctl.int_ctl & V_TPR_MASK));
+		WARN_ON_ONCE((svm->vmcb->control.int_ctl & V_TPR_MASK) !=
+			     (svm->nested.ctl.int_ctl & V_TPR_MASK));
 
 		svm->vmcb->control.int_ctl |= svm->nested.ctl.int_ctl &
 			V_IRQ_INJECTION_BITS_MASK;
@@ -2666,7 +2666,7 @@ static int cr_interception(struct kvm_vcpu *vcpu)
 			err = kvm_set_cr8(vcpu, val);
 			break;
 		default:
-			WARN(1, "unhandled write to CR%d", cr);
+			WARN_ONCE(1, "unhandled write to CR%d", cr);
 			kvm_queue_exception(vcpu, UD_VECTOR);
 			return 1;
 		}
@@ -2688,7 +2688,7 @@ static int cr_interception(struct kvm_vcpu *vcpu)
 			val = kvm_get_cr8(vcpu);
 			break;
 		default:
-			WARN(1, "unhandled read from CR%d", cr);
+			WARN_ONCE(1, "unhandled read from CR%d", cr);
 			kvm_queue_exception(vcpu, UD_VECTOR);
 			return 1;
 		}
@@ -2725,7 +2725,7 @@ static int cr_trap(struct kvm_vcpu *vcpu)
 		ret = kvm_set_cr8(vcpu, new_value);
 		break;
 	default:
-		WARN(1, "unhandled CR%d write trap", cr);
+		WARN_ONCE(1, "unhandled CR%d write trap", cr);
 		kvm_queue_exception(vcpu, UD_VECTOR);
 		return 1;
 	}
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 9b0bfa2f854cf9..ec3bc441a0e68f 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -515,7 +515,7 @@ static void nested_ept_new_eptp(struct kvm_vcpu *vcpu)
 
 static void nested_ept_init_mmu_context(struct kvm_vcpu *vcpu)
 {
-	WARN_ON(mmu_is_nested(vcpu));
+	WARN_ON_ONCE(mmu_is_nested(vcpu));
 
 	vcpu->arch.mmu = &vcpu->arch.guest_mmu;
 	nested_ept_new_eptp(vcpu);
@@ -1315,7 +1315,7 @@ static void nested_vmx_transition_tlb_flush(struct kvm_vcpu *vcpu,
 	}
 
 	/* L2 should never have a VPID if VPID is disabled. */
-	WARN_ON(!enable_vpid);
+	WARN_ON_ONCE(!enable_vpid);
 
 	/*
 	 * VPID is enabled and in use by vmcs12.  If vpid12 is changing, then
@@ -1698,7 +1698,7 @@ static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx)
 	unsigned long val;
 	int i;
 
-	if (WARN_ON(!shadow_vmcs))
+	if (WARN_ON_ONCE(!shadow_vmcs))
 		return;
 
 	preempt_disable();
@@ -1733,7 +1733,7 @@ static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx)
 	unsigned long val;
 	int i, q;
 
-	if (WARN_ON(!shadow_vmcs))
+	if (WARN_ON_ONCE(!shadow_vmcs))
 		return;
 
 	vmcs_load(shadow_vmcs);
@@ -4978,7 +4978,7 @@ static void nested_vmx_restore_host_state(struct kvm_vcpu *vcpu)
 		if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)
 			kvm_set_dr(vcpu, 7, DR7_FIXED_1);
 		else
-			WARN_ON(kvm_set_dr(vcpu, 7, vmcs_readl(GUEST_DR7)));
+			WARN_ON_ONCE(kvm_set_dr(vcpu, 7, vmcs_readl(GUEST_DR7)));
 	}
 
 	/* Reload DEBUGCTL to ensure vmcs01 has a fresh FREEZE_IN_SMM value. */
@@ -5408,7 +5408,7 @@ static struct vmcs *alloc_shadow_vmcs(struct kvm_vcpu *vcpu)
 	 * doesn't support virtualization of VMCS shadowing, so vmcs01 should
 	 * always be the loaded VMCS.
 	 */
-	if (WARN_ON(loaded_vmcs != &vmx->vmcs01 || loaded_vmcs->shadow_vmcs))
+	if (WARN_ON_ONCE(loaded_vmcs != &vmx->vmcs01 || loaded_vmcs->shadow_vmcs))
 		return loaded_vmcs->shadow_vmcs;
 
 	loaded_vmcs->shadow_vmcs = alloc_vmcs(true);
diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c
index 2644add54b76bc..0f508015692b4f 100644
--- a/arch/x86/kvm/vmx/posted_intr.c
+++ b/arch/x86/kvm/vmx/posted_intr.c
@@ -187,7 +187,7 @@ static void pi_enable_wakeup_handler(struct kvm_vcpu *vcpu)
 		      &per_cpu(wakeup_vcpus_on_cpu, vcpu->cpu));
 	raw_spin_unlock(&per_cpu(wakeup_vcpus_on_cpu_lock, vcpu->cpu));
 
-	WARN(pi_test_sn(pi_desc), "PI descriptor SN field set before blocking");
+	WARN_ONCE(pi_test_sn(pi_desc), "PI descriptor SN field set before blocking");
 
 	old.control = READ_ONCE(pi_desc->control);
 	do {
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index b341af4c6057a7..0038626f54868d 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -3089,7 +3089,7 @@ void free_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)
 	loaded_vmcs->vmcs = NULL;
 	if (loaded_vmcs->msr_bitmap)
 		free_page((unsigned long)loaded_vmcs->msr_bitmap);
-	WARN_ON(loaded_vmcs->shadow_vmcs != NULL);
+	WARN_ON_ONCE(loaded_vmcs->shadow_vmcs != NULL);
 }
 
 int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)
@@ -4468,7 +4468,7 @@ void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
 	unsigned long cr0, cr3, cr4;
 
 	cr0 = read_cr0();
-	WARN_ON(cr0 & X86_CR0_TS);
+	WARN_ON_ONCE(cr0 & X86_CR0_TS);
 	vmcs_writel(HOST_CR0, cr0);  /* 22.2.3 */
 
 	/*
@@ -5537,7 +5537,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu)
 			 * STI and MOVSS blocking.
 			 */
 			if (is_icebp(intr_info))
-				WARN_ON(!skip_emulated_instruction(vcpu));
+				WARN_ON_ONCE(!skip_emulated_instruction(vcpu));
 
 			kvm_queue_exception_p(vcpu, DB_VECTOR, dr6);
 			return 1;
@@ -5962,7 +5962,7 @@ static int handle_task_switch(struct kvm_vcpu *vcpu)
 	if (!idt_v || (type != INTR_TYPE_HARD_EXCEPTION &&
 		       type != INTR_TYPE_EXT_INTR &&
 		       type != INTR_TYPE_NMI_INTR))
-		WARN_ON(!skip_emulated_instruction(vcpu));
+		WARN_ON_ONCE(!skip_emulated_instruction(vcpu));
 
 	/*
 	 * TODO: What about debug traps on tss switch?
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 32563a91fba99a..a9be847d3cc2cc 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -370,7 +370,7 @@ static int exception_type(int vector)
 {
 	unsigned int mask;
 
-	if (WARN_ON(vector > 31 || vector == NMI_VECTOR))
+	if (WARN_ON_ONCE(vector > 31 || vector == NMI_VECTOR))
 		return EXCPT_INTERRUPT;
 
 	mask = 1 << vector;
@@ -4907,7 +4907,7 @@ static int kvm_fetch_guest_virt(struct x86_emulate_ctxt *ctxt,
 		return X86EMUL_PROPAGATE_FAULT;
 
 	offset = addr & (PAGE_SIZE-1);
-	if (WARN_ON(offset + bytes > PAGE_SIZE))
+	if (WARN_ON_ONCE(offset + bytes > PAGE_SIZE))
 		bytes = (unsigned)PAGE_SIZE - offset;
 	ret = kvm_vcpu_read_guest_page(vcpu, gpa >> PAGE_SHIFT, val,
 				       offset, bytes);
@@ -5167,7 +5167,7 @@ static int emulator_read_write_onepage(unsigned long addr, void *val,
 	bytes -= handled;
 	val += handled;
 
-	WARN_ON(vcpu->mmio_nr_fragments >= KVM_MAX_MMIO_FRAGMENTS);
+	WARN_ON_ONCE(vcpu->mmio_nr_fragments >= KVM_MAX_MMIO_FRAGMENTS);
 	frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++];
 	frag->gpa = gpa;
 	if (write && bytes <= 8u) {
@@ -7042,7 +7042,7 @@ static int kvm_x86_check_processor_compatibility(void)
 	 * compatible, i.e. KVM should never perform a compatibility check on
 	 * an offline CPU.
 	 */
-	WARN_ON(!cpu_online(cpu));
+	WARN_ON_ONCE(!cpu_online(cpu));
 
 	if (__cr4_reserved_bits(cpu_has, c) !=
 	    __cr4_reserved_bits(cpu_has, &boot_cpu_data))
@@ -7783,7 +7783,7 @@ static int kvm_check_and_inject_events(struct kvm_vcpu *vcpu,
 			vcpu->arch.nmi_injected = true;
 			kvm_x86_call(inject_nmi)(vcpu);
 			can_inject = false;
-			WARN_ON(kvm_x86_call(nmi_allowed)(vcpu, true) < 0);
+			WARN_ON_ONCE(kvm_x86_call(nmi_allowed)(vcpu, true) < 0);
 		}
 		if (vcpu->arch.nmi_pending)
 			kvm_x86_call(enable_nmi_window)(vcpu);
@@ -7800,7 +7800,7 @@ static int kvm_check_and_inject_events(struct kvm_vcpu *vcpu,
 			if (likely(irq != -1)) {
 				kvm_queue_interrupt(vcpu, irq, false);
 				kvm_x86_call(inject_irq)(vcpu, false);
-				WARN_ON(kvm_x86_call(interrupt_allowed)(vcpu, true) < 0);
+				WARN_ON_ONCE(kvm_x86_call(interrupt_allowed)(vcpu, true) < 0);
 			} else {
 				kvm_warn_on_lost_irq(vcpu);
 			}
@@ -8470,8 +8470,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 	 * KVM_DEBUGREG_WONT_EXIT again.
 	 */
 	if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT)) {
-		WARN_ON(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP);
-		WARN_ON(vcpu->arch.switch_db_regs & KVM_DEBUGREG_AUTO_SWITCH);
+		WARN_ON_ONCE(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP);
+		WARN_ON_ONCE(vcpu->arch.switch_db_regs & KVM_DEBUGREG_AUTO_SWITCH);
 		kvm_x86_call(sync_dirty_debug_regs)(vcpu);
 		kvm_update_dr0123(vcpu);
 		vcpu->arch.dr6 |= kvm_get_dr6_fixed_1(vcpu);
@@ -10038,7 +10038,7 @@ void __user * __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa,
 
 	lockdep_assert_held(&kvm->slots_lock);
 
-	if (WARN_ON(id >= KVM_MEM_SLOTS_NUM))
+	if (WARN_ON_ONCE(id >= KVM_MEM_SLOTS_NUM))
 		return ERR_PTR_USR(-EINVAL);
 
 	slot = id_to_memslot(slots, id);
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index cfe96962a4e48d..99ba31aa5ef5bc 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -348,7 +348,7 @@ static inline void adjust_tsc_offset_guest(struct kvm_vcpu *vcpu,
 static inline void adjust_tsc_offset_host(struct kvm_vcpu *vcpu, s64 adjustment)
 {
 	if (vcpu->arch.l1_tsc_scaling_ratio != kvm_caps.default_tsc_scaling_ratio)
-		WARN_ON(adjustment < 0);
+		WARN_ON_ONCE(adjustment < 0);
 	adjustment = kvm_scale_tsc((u64) adjustment,
 				   vcpu->arch.l1_tsc_scaling_ratio);
 	adjust_tsc_offset_guest(vcpu, adjustment);

3/2 2026/10/29 08:19 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 11260
							output: 24
							thoughts: 1680
						

Thoughts:
**Patch Analysis: Fuzzing Recommendation**

Okay, let's break this down. This patch in `arch/x86/kvm/` is converting a bunch of `WARN_ON(...)` and `WARN(...)` calls to `WARN_ON_ONCE(...)` and `WARN_ONCE(...)`, and also changing some `WARN_ON(preemptible())` instances to `lockdep_assert_preemption_disabled()`. My initial instinct is to assess whether these changes warrant fuzzing.

First, the guiding principle: **reachability is key**. Can the modified code actually execute in a standard virtualized environment like QEMU, or even GCE, using software-emulated devices?  Here, KVM on x86 is reachable and fuzzed heavily by syzkaller.

Next, I need to look closely at this instruction set. This document is adamant: don't automatically trust claims of "no functional change" or "refactoring."  If a patch introduces or modifies runtime checks or assertions in reachable code, it needs fuzzing to verify any new invariants are indeed sound.

The critical question is whether these changes introduce or modify assertions. `WARN_ON` is clearly an assertion, and even converting to `WARN_ON_ONCE` or `WARN_ONCE` is a modification of that assertion - changing the frequency of the warning. But what about `lockdep_assert_preemption_disabled()`? Let's check the definition. It expands to `WARN_ON_ONCE(IS_ENABLED(CONFIG_PREEMPT_COUNT) && preemptible())`, meaning it is a modification. So, yes, it does modify assertions and can even be seen as a stricter check.

Now, let's consider the negative criteria. The document explicitly says we *only* return `WorthFuzzing=false` if the code falls *strictly* into one or more of these categories: non-kernel/non-executable changes (documentation, user-space tools, decorative logging), structurally unreachable hardware, or unreachable execution paths.  This patch is *not* documentation, user-space, or decorative. The changes are within kernel C code. Also, none of the negative criteria apply here. This patch touches reachable executable code, directly within the core KVM x86 subsystem: `lapic.c`, `x86.c`, `svm/nested.c`, `vmx/nested.c`, etc.

The document is pretty clear: *any* modification to assertions (including from `WARN_ON` to `WARN_ON_ONCE` and `WARN_ON(preemptible())` to `lockdep_assert_preemption_disabled()`) in reachable code *must* be fuzzed. That's a direct quote!

In conclusion, this patch *absolutely* warrants fuzzing. The changes are in reachable executable code, and they directly introduce or modify runtime assertions. There is no doubt about it. The fuzzing should be run in QEMU (syzkaller).



4/2 2026/10/29 08:19 tool grepper
0m Args:
{
  "Expression": "define lockdep_assert_preemption_disabled"
}

Results:
{
  "Output": "include/linux/lockdep.h=600=do {\t\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/lockdep.h-606-\ninclude/linux/lockdep.h:607:#define lockdep_assert_preemption_disabled()\t\t\t\t\\\ninclude/linux/lockdep.h-608-do {\t\t\t\t\t\t\t\t\t\\\n--\ninclude/linux/lockdep.h=625=extern void lockdep_assert_in_softirq_func(void);\n--\ninclude/linux/lockdep.h-637-# define lockdep_assert_preemption_enabled() do { } while (0)\ninclude/linux/lockdep.h:638:# define lockdep_assert_preemption_disabled() do { } while (0)\ninclude/linux/lockdep.h-639-# define lockdep_assert_in_softirq() do { } while (0)\n"
}

5/2 2026/10/29 08:20 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 13829
							output: 36
							thoughts: 22
						

Thoughts:
Okay, let's dive into this. Here's how I'd approach summarizing the prompt:

**Inspecting `include/linux/lockdep.h` Around Line 607**

Alright, my first instinct is to zero in on that specific area of `include/linux/lockdep.h`. Line 607 itself isn't the whole story, so I'm going to look at the surrounding code as well. What's the context? What definitions, data structures, or functions are immediately before and after line 607? Is it a key data structure declaration, a function call, or a conditional? Knowing the surrounding code is crucial to understand its implications within the larger lockdep framework.

I'm thinking about the typical things that would be defined in a header file like this. Is it a `struct` definition related to lock dependency tracking? Perhaps it's an inline function for checking lock validity or a macro for debugging output? Line numbers are often helpful for pinpointing specific issues or features within a codebase, so I want to understand what the code on or around line 607 is trying to achieve. Is it a crucial part of the algorithm, a debugging aid, or possibly a hook used by other modules?

The goal here is to grasp the local code's function, its relationship to the broader lockdep system, and any potential implications for lock contention, deadlock detection, or runtime analysis. I'm going to quickly skim the surrounding lines for keywords or patterns that stand out, and I'll look for any comments that might provide clues about the code's intent. Let's see what we've got!



6/2 2026/10/29 08:20 tool read-file
0m Args:
{
  "File": "include/linux/lockdep.h",
  "FirstLine": 605,
  "LineCount": 20
}

Results:
{
  "Contents": " 605:\t} while (0)\n 606:\t\n 607:\t#define lockdep_assert_preemption_disabled()\t\t\t\t\\\n 608:\tdo {\t\t\t\t\t\t\t\t\t\\\n 609:\t\tWARN_ON_ONCE(IS_ENABLED(CONFIG_PREEMPT_COUNT)\t\u0026\u0026\t\t\\\n 610:\t\t\t     __lockdep_enabled\t\t\t\u0026\u0026\t\t\\\n 611:\t\t\t     (preempt_count() == 0\t\t\u0026\u0026\t\t\\\n 612:\t\t\t      this_cpu_read(hardirqs_enabled)));\t\t\\\n 613:\t} while (0)\n 614:\t\n 615:\t/*\n 616:\t * Acceptable for protecting per-CPU resources accessed from BH.\n 617:\t * Much like in_softirq() - semantics are ambiguous, use carefully.\n 618:\t */\n 619:\t#define lockdep_assert_in_softirq()\t\t\t\t\t\\\n 620:\tdo {\t\t\t\t\t\t\t\t\t\\\n 621:\t\tWARN_ON_ONCE(__lockdep_enabled\t\t\t\u0026\u0026\t\t\\\n 622:\t\t\t     (!in_softirq() || in_hardirq() || in_nmi()));\t\\\n 623:\t} while (0)\n 624:\t\n"
}

7/2 2026/10/29 08:20 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 14571
							output: 50
							thoughts: 79
						

Thoughts:
Here's my analysis of the situation:

**Worth Fuzzing: A Quick Look at `lockdep_assert_preemption_disabled`**

Okay, so `lockdep_assert_preemption_disabled` is screaming "fuzz me!" immediately. The presence of the assertion itself, and the fact that it's conditional on both `CONFIG_PREEMPT_COUNT` and `CONFIG_LOCKDEP` (which in turn relies on `__lockdep_enabled`) tells me right away that this is a prime candidate for fuzzing. These kinds of runtime checks often indicate subtle locking or preemption interactions that could be tricky to debug manually. The conditions strongly suggest that triggering the assertion will involve specific kernel configurations and potentially race conditions or state-dependent behavior.

Now, let's dig into the details. I need to understand the context. I'll start by checking the relevant commit history, any modified files, and associated symbols. Understanding the surrounding code will clarify the purpose of this assertion and potential scenarios where it could be violated. A quick `git log` lookup will be essential to establish the origins of this assertion. From there I'll be able to work through the relevant logic, hopefully quickly, and determine where the value can be misconfigured.



8/2 2026/10/29 08:20 tool grepper
0m Error:
no matches

Args:
{
  "Expression": "commit 5ad32865239365715bdc4fe064d55fd1494ae8be"
}

Results:
{
  "error": "no matches"
}

9/2 2026/10/29 08:20 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 14976
							output: 42
							thoughts: 1277
						

Thoughts:
**Focusing the Fuzzer: Identifying Key KVM Functions for Targeted Fuzzing**

Alright, so `grepper` is searching the code base itself, not the git log, which is fine for this task. I need to zero in on specific functions within these KVM changes to guide the fuzzer effectively. My initial step is to list all modified functions, and I've got a comprehensive list from the diff:

*   `arch/x86/kvm/hyperv.c`: `hv_tlb_flush_enqueue`
*   `arch/x86/kvm/i8254.c`: `kvm_pit_load_count`
*   `arch/x86/kvm/irq.c`: `kvm_cpu_get_extint`, `kvm_arch_irq_bypass_del_producer`
*   `arch/x86/kvm/lapic.c`: `apic_timer_expired`, `cancel_hv_timer`, `start_hv_timer`, `start_sw_timer`, `kvm_lapic_expired_hv_timer`, `kvm_lapic_restart_hv_timer`
*   `arch/x86/kvm/mmu/tdp_mmu.c`: `kvm_mmu_uninit_tdp_mmu`, `__kvm_tdp_mmu_age_gfn_range`
*   `arch/x86/kvm/msrs.c`: `set_efer`
*   `arch/x86/kvm/svm/avic.c`: `__avic_vcpu_load`
*   `arch/x86/kvm/svm/nested.c`: `nested_svm_init_mmu_context`, `nested_svm_init_msrpm_merge_offsets` (this is marked as `__init`), `enter_svm_guest_mode`, `nested_svm_inject_exception_vmexit`, `svm_get_nested_state_pages`
*   `arch/x86/kvm/svm/sev.c`: `sev_vm_destroy`
*   `arch/x86/kvm/svm/svm.c`: `svm_set_vintr`, `svm_clear_vintr`, `cr_interception`, `cr_trap`
*   `arch/x86/kvm/vmx/nested.c`: `nested_ept_init_mmu_context`, `nested_vmx_transition_tlb_flush`, `copy_shadow_to_vmcs12`, `copy_vmcs12_to_shadow`, `nested_vmx_restore_host_state`, `alloc_shadow_vmcs`
*   `arch/x86/kvm/vmx/posted_intr.c`: `pi_enable_wakeup_handler`
*   `arch/x86/kvm/vmx/vmx.c`: `free_loaded_vmcs`, `vmx_set_constant_host_state`, `handle_exception_nmi`, `handle_task_switch`
*   `arch/x86/kvm/x86.c`: `exception_type`, `kvm_fetch_guest_virt`, `emulator_read_write_onepage`, `kvm_x86_check_processor_compatibility`, `kvm_check_and_inject_events`, `vcpu_enter_guest`, `__x86_set_memory_region`
*   `arch/x86/kvm/x86.h`: `adjust_tsc_offset_host` (static inline)

Now, applying the FocusSymbols guidelines is crucial. I need to avoid listing generic functions like memory allocators or common trap handlers. Instead, the focus should be on functions that implement specific logic related to the changes or direct API entry points for the feature under review. Furthermore, if changes are primarily in static inline helpers, I should identify the non-static caller functions that exercise them to guide the fuzzer effectively.

So, let's start by identifying the most specific, non-ubiquitous functions where these assertion changes might be. Looking at `lapic.c`, the `cancel_hv_timer` is static, which is a potential issue, so are any of the others. I need to determine if they're actually inlined or have symbol information. I'll need to check `start_sw_timer`, `start_hv_timer`, `kvm_lapic_expired_hv_timer`, `kvm_


10/2 2026/10/29 08:20 tool read-file
0m Args:
{
  "File": "arch/x86/kvm/lapic.c",
  "FirstLine": 2270,
  "LineCount": 80
}

Results:
{
  "Contents": "2270:\t\n2271:\tstatic void cancel_hv_timer(struct kvm_lapic *apic)\n2272:\t{\n2273:\t\tlockdep_assert_preemption_disabled();\n2274:\t\n2275:\t\tWARN_ON_ONCE(!apic-\u003elapic_timer.hv_timer_in_use);\n2276:\t\tkvm_x86_call(cancel_hv_timer)(apic-\u003evcpu);\n2277:\t\tapic-\u003elapic_timer.hv_timer_in_use = false;\n2278:\t}\n2279:\t\n2280:\tstatic bool start_hv_timer(struct kvm_lapic *apic)\n2281:\t{\n2282:\t\tstruct kvm_timer *ktimer = \u0026apic-\u003elapic_timer;\n2283:\t\tstruct kvm_vcpu *vcpu = apic-\u003evcpu;\n2284:\t\tbool expired;\n2285:\t\n2286:\t\tlockdep_assert_preemption_disabled();\n2287:\t\n2288:\t\tif (!kvm_can_use_hv_timer(vcpu))\n2289:\t\t\treturn false;\n2290:\t\n2291:\t\tif (!ktimer-\u003etscdeadline)\n2292:\t\t\treturn false;\n2293:\t\n2294:\t\tif (kvm_x86_call(set_hv_timer)(vcpu, ktimer-\u003etscdeadline, \u0026expired))\n2295:\t\t\treturn false;\n2296:\t\n2297:\t\tktimer-\u003ehv_timer_in_use = true;\n2298:\t\thrtimer_cancel(\u0026ktimer-\u003etimer);\n2299:\t\n2300:\t\t/*\n2301:\t\t * To simplify handling the periodic timer, leave the hv timer running\n2302:\t\t * even if the deadline timer has expired, i.e. rely on the resulting\n2303:\t\t * VM-Exit to recompute the periodic timer's target expiration.\n2304:\t\t */\n2305:\t\tif (!apic_lvtt_period(apic)) {\n2306:\t\t\t/*\n2307:\t\t\t * Cancel the hv timer if the sw timer fired while the hv timer\n2308:\t\t\t * was being programmed, or if the hv timer itself expired.\n2309:\t\t\t */\n2310:\t\t\tif (atomic_read(\u0026ktimer-\u003epending)) {\n2311:\t\t\t\tcancel_hv_timer(apic);\n2312:\t\t\t} else if (expired) {\n2313:\t\t\t\tapic_timer_expired(apic, false);\n2314:\t\t\t\tcancel_hv_timer(apic);\n2315:\t\t\t}\n2316:\t\t}\n2317:\t\n2318:\t\ttrace_kvm_hv_timer_state(vcpu-\u003evcpu_id, ktimer-\u003ehv_timer_in_use);\n2319:\t\n2320:\t\treturn true;\n2321:\t}\n2322:\t\n2323:\tstatic void start_sw_timer(struct kvm_lapic *apic)\n2324:\t{\n2325:\t\tstruct kvm_timer *ktimer = \u0026apic-\u003elapic_timer;\n2326:\t\n2327:\t\tlockdep_assert_preemption_disabled();\n2328:\t\n2329:\t\tif (apic-\u003elapic_timer.hv_timer_in_use)\n2330:\t\t\tcancel_hv_timer(apic);\n2331:\t\tif (!apic_lvtt_period(apic) \u0026\u0026 atomic_read(\u0026ktimer-\u003epending))\n2332:\t\t\treturn;\n2333:\t\n2334:\t\tif (apic_lvtt_period(apic) || apic_lvtt_oneshot(apic))\n2335:\t\t\tstart_sw_period(apic);\n2336:\t\telse if (apic_lvtt_tscdeadline(apic))\n2337:\t\t\tstart_sw_tscdeadline(apic);\n2338:\t\ttrace_kvm_hv_timer_state(apic-\u003evcpu-\u003evcpu_id, false);\n2339:\t}\n2340:\t\n2341:\tstatic void restart_apic_timer(struct kvm_lapic *apic)\n2342:\t{\n2343:\t\tpreempt_disable();\n2344:\t\n2345:\t\tif (!apic_lvtt_period(apic) \u0026\u0026 atomic_read(\u0026apic-\u003elapic_timer.pending))\n2346:\t\t\tgoto out;\n2347:\t\n2348:\t\tif (!start_hv_timer(apic))\n2349:\t\t\tstart_sw_timer(apic);\n"
}

11/2 2026/10/29 08:20 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 18571
							output: 35
							thoughts: 748
						

Thoughts:
**My Current Thinking: Filtering Relevant KVM Focus Symbols**

Okay, let's get down to brass tacks. I'm going through the KVM codebase, mentally sifting through function names, and trying to isolate those that represent *specific* feature logic – potential "focus symbols" for fuzzing. I need to avoid the generic, ubiquitous functions that will just clutter the results and dilute the fuzzing effort.

Right now, I'm examining: `restart_apic_timer`, `kvm_lapic_restart_hv_timer`, and `kvm_lapic_expired_hv_timer`. I'm also considering `hv_tlb_flush_enqueue` in `hyperv.c`. Then moving to `svm/nested.c` and considering `enter_svm_guest_mode` and `svm_get_nested_state_pages`. From `vmx/nested.c`, I'm looking at `copy_shadow_to_vmcs12`, `copy_vmcs12_to_shadow`, `nested_vmx_restore_host_state`, and `alloc_shadow_vmcs`. The `svm/svm.c` file is next, and I need to check out `svm_set_vintr`, `svm_clear_vintr`, and `cr_interception`. I'm also going through `tdp_mmu.c`: `kvm_mmu_uninit_tdp_mmu`, and `__kvm_tdp_mmu_age_gfn_range`. I cannot forget `irq.c`: `kvm_cpu_get_extint`, and `kvm_arch_irq_bypass_del_producer`. Let's not forget `i8254.c`: `kvm_pit_load_count`

But wait, hold on! Before I get carried away, I need to remind myself of the "AVOID UBIQUITOUS LIFECYCLE HOT-PATHS" rule. Functions like `vcpu_enter_guest` are *out*. It's the core execution loop; listing that would be a complete waste of time. Similarly, `kvm_fetch_guest_virt` or `exception_type` are probably too generic.

So, let's re-evaluate the list, keeping in mind that I'm aiming for direct, specific feature logic. I'm focusing on these for potential focus symbols: `kvm_lapic_expired_hv_timer`, `kvm_lapic_restart_hv_timer`, `hv_tlb_flush_enqueue`, `enter_svm_guest_mode`, `svm_set_vintr`, `svm_clear_vintr`, `nested_vmx_restore_host_state`, `alloc_shadow_vmcs`, `kvm_pit_load_count`, `kvm_arch_irq_bypass_del_producer`, `copy_shadow_to_vmcs12`, and `copy_vmcs12_to_shadow`. I also want to check `__avic_vcpu_load` or `pi_enable_wakeup_handler`.

Now, I need to figure out how many focus symbols are ideal and what configurations are required for KVM x86. I need to delve into the Kconfig files. Let's see... KVM, KVM_INTEL, KVM_AMD... let's check `arch/x86/kvm/Kconfig` to see what options are available. This will inform my final list.



12/2 2026/10/29 08:21 tool grepper
0m Args:
{
  "Expression": "config KVM",
  "PathPrefixes": [
    "arch/x86/kvm/Kconfig"
  ]
}

Results:
{
  "Output": "arch/x86/kvm/Kconfig=18=if VIRTUALIZATION\narch/x86/kvm/Kconfig-19-\narch/x86/kvm/Kconfig:20:config KVM_X86\narch/x86/kvm/Kconfig-21-\tdef_tristate KVM if (KVM_INTEL != n || KVM_AMD != n)\n--\narch/x86/kvm/Kconfig-47-\narch/x86/kvm/Kconfig:48:config KVM\narch/x86/kvm/Kconfig-49-\ttristate \"Kernel-based Virtual Machine (KVM) support\"\n--\narch/x86/kvm/Kconfig-64-\narch/x86/kvm/Kconfig:65:config KVM_WERROR\narch/x86/kvm/Kconfig-66-\tbool \"Compile KVM with -Werror\"\n--\narch/x86/kvm/Kconfig-78-\narch/x86/kvm/Kconfig:79:config KVM_PRIVATE_MEMATTR_VM\narch/x86/kvm/Kconfig-80-\tbool \"Enable per-VM PRIVATE vs. SHARED attributes (for CoCo VMs)\"\n--\narch/x86/kvm/Kconfig-92-\narch/x86/kvm/Kconfig:93:config KVM_SW_PROTECTED_VM\narch/x86/kvm/Kconfig-94-\tbool \"Enable support for KVM software-protected VMs\"\n--\narch/x86/kvm/Kconfig-104-\narch/x86/kvm/Kconfig:105:config KVM_INTEL\narch/x86/kvm/Kconfig-106-\ttristate \"KVM for Intel (and compatible) processors support\"\n--\narch/x86/kvm/Kconfig-115-\narch/x86/kvm/Kconfig:116:config KVM_INTEL_PROVE_VE\narch/x86/kvm/Kconfig-117-        bool \"Check that guests do not receive #VE exceptions\"\n--\narch/x86/kvm/Kconfig=131=config X86_SGX_KVM\n--\narch/x86/kvm/Kconfig-142-\narch/x86/kvm/Kconfig:143:config KVM_INTEL_TDX\narch/x86/kvm/Kconfig-144-\tbool \"Intel Trust Domain Extensions (TDX) support\"\n--\narch/x86/kvm/Kconfig-153-\narch/x86/kvm/Kconfig:154:config KVM_AMD\narch/x86/kvm/Kconfig-155-\ttristate \"KVM for AMD processors support\"\n--\narch/x86/kvm/Kconfig-163-\narch/x86/kvm/Kconfig:164:config KVM_AMD_SEV\narch/x86/kvm/Kconfig-165-\tbool \"AMD Secure Encrypted Virtualization (SEV) support\"\n--\narch/x86/kvm/Kconfig-179-\narch/x86/kvm/Kconfig:180:config KVM_IOAPIC\narch/x86/kvm/Kconfig-181-\tbool \"I/O APIC, PIC, and PIT emulation\"\n--\narch/x86/kvm/Kconfig-189-\narch/x86/kvm/Kconfig:190:config KVM_SMM\narch/x86/kvm/Kconfig-191-\tbool \"System Management Mode emulation\"\n--\narch/x86/kvm/Kconfig-200-\narch/x86/kvm/Kconfig:201:config KVM_HYPERV\narch/x86/kvm/Kconfig-202-\tbool \"Support for Microsoft Hyper-V emulation\"\n--\narch/x86/kvm/Kconfig-214-\narch/x86/kvm/Kconfig:215:config KVM_XEN\narch/x86/kvm/Kconfig-216-\tbool \"Support for Xen hypercall interface\"\n--\narch/x86/kvm/Kconfig-223-\narch/x86/kvm/Kconfig:224:config KVM_PROVE_MMU\narch/x86/kvm/Kconfig-225-\tbool \"Prove KVM MMU correctness\"\n--\narch/x86/kvm/Kconfig-236-\narch/x86/kvm/Kconfig:237:config KVM_EXTERNAL_WRITE_TRACKING\narch/x86/kvm/Kconfig-238-\tbool\narch/x86/kvm/Kconfig-239-\narch/x86/kvm/Kconfig:240:config KVM_MAX_NR_VCPUS\narch/x86/kvm/Kconfig-241-\tint \"Maximum number of vCPUs per KVM guest\"\n"
}

13/2 2026/10/29 08:21 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 21416
							output: 36
							thoughts: 25
						

Thoughts:
Okay, here's my take on those thoughts, tailored for an expert audience and presented in the first person:

**Navigating the KVM Compilation Process**

Alright, so I need to understand how these recent changes I've made to the KVM x86 code are actually compiled. The best place to start, as always, is the `arch/x86/kvm/Makefile`. It's the central point of control for the build process specific to KVM on x86, so it'll definitely define the rules that govern how my modified files are integrated. I'm especially interested in looking at the dependencies, compiler flags being used, and any specific target definitions that apply to the KVM modules and their compilation. I will also be looking to determine if there are any specific object files.



14/2 2026/10/29 08:21 tool read-file
0m Args:
{
  "File": "arch/x86/kvm/Makefile",
  "FirstLine": 1,
  "LineCount": 50
}

Results:
{
  "Contents": "   1:\t# SPDX-License-Identifier: GPL-2.0\n   2:\t\n   3:\tccflags-y += -I $(srctree)/arch/x86/kvm\n   4:\tccflags-$(CONFIG_KVM_WERROR) += -Werror\n   5:\t\n   6:\tinclude $(srctree)/virt/kvm/Makefile.kvm\n   7:\t\n   8:\tkvm-y\t\t\t+= x86.o emulate.o irq.o lapic.o cpuid.o msrs.o pmu.o regs.o \\\n   9:\t\t\t\t   mtrr.o debugfs.o mmu/mmu.o mmu/page_track.o mmu/spte.o\n  10:\t\n  11:\tkvm-$(CONFIG_X86_64) += mmu/tdp_iter.o mmu/tdp_mmu.o\n  12:\tkvm-$(CONFIG_KVM_IOAPIC) += i8259.o i8254.o ioapic.o\n  13:\tkvm-$(CONFIG_KVM_HYPERV) += hyperv.o\n  14:\tkvm-$(CONFIG_KVM_XEN)\t+= xen.o\n  15:\tkvm-$(CONFIG_KVM_SMM)\t+= smm.o\n  16:\t\n  17:\tkvm-intel-y\t\t+= vmx/vmx.o vmx/vmenter.o vmx/pmu_intel.o vmx/vmcs12.o \\\n  18:\t\t\t\t   vmx/nested.o vmx/posted_intr.o vmx/main.o\n  19:\t\n  20:\tkvm-intel-$(CONFIG_X86_SGX_KVM)\t+= vmx/sgx.o\n  21:\tkvm-intel-$(CONFIG_KVM_HYPERV)\t+= vmx/hyperv.o vmx/hyperv_evmcs.o\n  22:\tkvm-intel-$(CONFIG_KVM_INTEL_TDX)\t+= vmx/tdx.o\n  23:\t\n  24:\tkvm-amd-y\t\t+= svm/svm.o svm/vmenter.o svm/pmu.o svm/nested.o svm/avic.o\n  25:\t\n  26:\tkvm-amd-$(CONFIG_KVM_AMD_SEV)\t+= svm/sev.o\n  27:\tkvm-amd-$(CONFIG_KVM_HYPERV)\t+= svm/hyperv.o\n  28:\t\n  29:\tifdef CONFIG_HYPERV\n  30:\tkvm-y\t\t\t+= kvm_onhyperv.o\n  31:\tkvm-intel-y\t\t+= vmx/vmx_onhyperv.o vmx/hyperv_evmcs.o\n  32:\tkvm-amd-y\t\t+= svm/svm_onhyperv.o\n  33:\tendif\n  34:\t\n  35:\tobj-$(CONFIG_KVM_X86)\t+= kvm.o\n  36:\tobj-$(CONFIG_KVM_INTEL)\t+= kvm-intel.o\n  37:\tobj-$(CONFIG_KVM_AMD)\t+= kvm-amd.o\n  38:\t\n  39:\tAFLAGS_svm/vmenter.o    := -iquote $(obj)\n  40:\t$(obj)/svm/vmenter.o: $(obj)/kvm-asm-offsets.h\n  41:\t\n  42:\tAFLAGS_vmx/vmenter.o    := -iquote $(obj)\n  43:\t$(obj)/vmx/vmenter.o: $(obj)/kvm-asm-offsets.h\n  44:\t\n  45:\t$(obj)/kvm-asm-offsets.h: $(obj)/kvm-asm-offsets.s FORCE\n  46:\t\t$(call filechk,offsets,__KVM_ASM_OFFSETS_H__)\n  47:\t\n  48:\ttargets += kvm-asm-offsets.s\n  49:\tclean-files += kvm-asm-offsets.h\n  50:\t\n"
}

15/2 2026/10/29 08:21 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 22697
							output: 39
							thoughts: 498
						

Thoughts:
**Analyzing the KVM Makefile for Conditional Compilation**

Okay, so I'm diving into this Makefile and immediately see the conditional compilation in action. The `kvm-y += ...` lines are the core of it all, determining which object files get included based on kernel configuration options.

First, I see the base KVM modules under `CONFIG_KVM` and `CONFIG_KVM_X86`. Pretty standard stuff, the foundational blocks. Then, things get interesting. `CONFIG_X86_64` brings in `mmu` related files. The `kvm-$(CONFIG_KVM_IOAPIC)` section catches my eye immediately - not just the inclusion of `i8259.o`, `i8254.o`, and `ioapic.o`, but the note about modifications to `i8254.c`. I'll want to remember that when debugging. Similarly, `CONFIG_KVM_HYPERV` includes `hyperv.o` and flags changes to the `hyperv.c` file, same for `CONFIG_KVM_INTEL`, `CONFIG_KVM_AMD`, and `CONFIG_KVM_AMD_SEV` are also interesting as there are also changes to the files.

And don't forget the lock dependency and preemption, as `lockdep_assert_preemption_disabled()` seems to need to be considered.

So, I'm going to quickly check the default settings for the following config options: `CONFIG_KVM_IOAPIC`, `CONFIG_KVM_HYPERV`, `CONFIG_KVM_INTEL`, `CONFIG_KVM_AMD`, `CONFIG_KVM_AMD_SEV`, and `CONFIG_KVM`.
And let's make sure `KVM_IOAPIC` is set to "y" by default. This will give me an overall picture of what's *always* enabled versus what's conditional.



16/2 2026/10/29 08:21 tool grepper
0m Args:
{
  "Expression": "config KVM_IOAPIC",
  "PathPrefixes": [
    "arch/x86/kvm/Kconfig"
  ]
}

Results:
{
  "Output": "arch/x86/kvm/Kconfig=164=config KVM_AMD_SEV\n--\narch/x86/kvm/Kconfig-179-\narch/x86/kvm/Kconfig:180:config KVM_IOAPIC\narch/x86/kvm/Kconfig-181-\tbool \"I/O APIC, PIC, and PIT emulation\"\n"
}

17/2 2026/10/29 08:21 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 23770
							output: 39
							thoughts: 28
						

Thoughts:
Okay, let's dive into this. I'm going to pull up `arch/x86/kvm/Kconfig` and zero in on lines 180 and 200. I need to understand what's being configured there, probably some feature or setting related to KVM on x86. I'll be looking for keywords, dependencies, and any hints about the impact of the configuration options defined there. This likely relates to hardware virtualization extensions, specific CPU features, or performance-related settings within the KVM environment. I'll pay close attention to the context around those lines – what precedes and follows them – to get the full picture. My goal is to quickly grasp the essence of what's being controlled and how it affects the overall KVM setup. I'm expecting this to be fairly straightforward, given my familiarity with Kconfig and KVM internals, but always good to double check the details.



18/2 2026/10/29 08:21 tool read-file
0m Args:
{
  "File": "arch/x86/kvm/Kconfig",
  "FirstLine": 178,
  "LineCount": 40
}

Results:
{
  "Contents": " 178:\t\t  Secure Nested Paging (SEV-SNP) technologies on AMD processors.\n 179:\t\n 180:\tconfig KVM_IOAPIC\n 181:\t\tbool \"I/O APIC, PIC, and PIT emulation\"\n 182:\t\tdefault y\n 183:\t\tdepends on KVM_X86\n 184:\t\thelp\n 185:\t\t  Provides support for KVM to emulate an I/O APIC, PIC, and PIT, i.e.\n 186:\t\t  for full in-kernel APIC emulation.\n 187:\t\n 188:\t\t  If unsure, say Y.\n 189:\t\n 190:\tconfig KVM_SMM\n 191:\t\tbool \"System Management Mode emulation\"\n 192:\t\tdefault y\n 193:\t\tdepends on KVM_X86\n 194:\t\thelp\n 195:\t\t  Provides support for KVM to emulate System Management Mode (SMM)\n 196:\t\t  in virtual machines.  This can be used by the virtual machine\n 197:\t\t  firmware to implement UEFI secure boot.\n 198:\t\n 199:\t\t  If unsure, say Y.\n 200:\t\n 201:\tconfig KVM_HYPERV\n 202:\t\tbool \"Support for Microsoft Hyper-V emulation\"\n 203:\t\tdepends on KVM_X86\n 204:\t\tdefault y\n 205:\t\thelp\n 206:\t\t  Provides KVM support for emulating Microsoft Hyper-V.  This allows KVM\n 207:\t\t  to expose a subset of the paravirtualized interfaces defined in the\n 208:\t\t  Hyper-V Hypervisor Top-Level Functional Specification (TLFS):\n 209:\t\t  https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/reference/tlfs\n 210:\t\t  These interfaces are required for the correct and performant functioning\n 211:\t\t  of Windows and Hyper-V guests on KVM.\n 212:\t\n 213:\t\t  If unsure, say \"Y\".\n 214:\t\n 215:\tconfig KVM_XEN\n 216:\t\tbool \"Support for Xen hypercall interface\"\n 217:\t\tdepends on KVM_X86\n"
}

19/2 2026/10/29 08:21 llm patch-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 24642
							output: 377
							thoughts: 1865
						

Thoughts:
**Focusing on KVM Configuration and Symbolic Analysis**

Okay, so I'm diving into this KVM patch, and the first thing I need to nail down are the relevant configuration options.  I know `KVM_INTEL` and `KVM_AMD` are key, and they both depend on `KVM_X86`.  `KVM` itself is tristate, so that sets the base.  Then there's `KVM_HYPERV`, `KVM_IOAPIC`, and `KVM_AMD_SEV`.  And of course, `PROVE_LOCKING` or `LOCKDEP`, which are pertinent.

Now, the real meat of this is figuring out the *right* `FocusSymbols`. Let's scrutinize the changed functions. We have a list of functions affected. It's time to sift through these, and narrow down a representative set. It looks like it touches `hv_tlb_flush_enqueue`, `kvm_pit_load_count`, `kvm_cpu_get_extint`, `kvm_arch_irq_bypass_del_producer`, `kvm_lapic_expired_hv_timer`, `kvm_lapic_restart_hv_timer`, `cancel_hv_timer`, `start_hv_timer`, `start_sw_timer`, `kvm_mmu_uninit_tdp_mmu`, `__kvm_tdp_mmu_age_gfn_range`, `set_efer`, `__avic_vcpu_load`, `enter_svm_guest_mode`, `svm_get_nested_state_pages`, `svm_set_vintr`, `svm_clear_vintr`, `nested_vmx_restore_host_state`, `copy_shadow_to_vmcs12`, `copy_vmcs12_to_shadow`, `alloc_shadow_vmcs`, `pi_enable_wakeup_handler`, `handle_task_switch`, and `handle_exception_nmi`.

Wait, a crucial question pops up: are static functions distinct symbols? Right, generally, static non-inlined functions *do* have symbols, but let's double-check which ones could be inlined. I need to know which of these are static because their visibility is limited to the `.c` file and can be inlined by the compiler. Let's see... looking at the list, `kvm_lapic_expired_hv_timer`, `kvm_lapic_restart_hv_timer`, `enter_svm_guest_mode`, and `kvm_mmu_uninit_tdp_mmu` aren't static. Okay, so that narrows down the non-static functions. Also, looking at the static functions, `nested_vmx_restore_host_state`, `alloc_shadow_vmcs`, `svm_set_vintr` and `svm_clear_vintr` are static. Also `kvm_arch_irq_bypass_del_producer`, `kvm_pit_load_count`, `hv_tlb_flush_enqueue` and `set_efer` are static.

Alright, so a sensible set of FocusSymbols, focusing on a clean and representative selection from the modified functions might include: `cancel_hv_timer`, `start_hv_timer`, `start_sw_timer`, `kvm_lapic_expired_hv_timer`, `kvm_lapic_restart_hv_timer`, `enter_svm_guest_mode`, `svm_set_vintr`, `svm_clear_vintr`, `alloc_shadow_vmcs`, `copy_shadow_to_vmcs12`, `copy_vmcs12_to_shadow`, `nested_vmx_restore_host_state`, `hv_tlb_flush_enqueue`, `kvm_arch_irq_bypass_del_producer`, and `pi_enable_wakeup_handler`.

Hang on, a quick sanity check: are any of these *ubiquitous* functions? No, none of these are memory allocators, page fault handlers, spinlocks, or the guest run loop. These seem specific to Hyper-V timer emulation, nested SVM entry, virtual interrupt injection, VMCS shadowing, posted interrupt wakeup, Hyper-V TLB flush, etc. This is good; we are focusing on the more specific aspects of the KVM code that are touched by the patch.

Let's do one last config double-check. KVM depends on VIRTUALIZATION. KVM_INTEL depends on KVM and x86 architectures, and the same goes for AMD. AMD_SEV depends on AMD. Hyper-V depends on X


20/2 2026/10/29 08:22 tool set-results
0m Args:
{
  "EnableConfigs": [
    "KVM",
    "KVM_INTEL",
    "KVM_AMD",
    "KVM_HYPERV",
    "KVM_IOAPIC",
    "KVM_AMD_SEV",
    "PROVE_LOCKING"
  ],
  "FocusSymbols": [
    "cancel_hv_timer",
    "start_hv_timer",
    "start_sw_timer",
    "kvm_lapic_expired_hv_timer",
    "kvm_lapic_restart_hv_timer",
    "hv_tlb_flush_enqueue",
    "enter_svm_guest_mode",
    "svm_set_vintr",
    "svm_clear_vintr",
    "alloc_shadow_vmcs",
    "copy_shadow_to_vmcs12",
    "copy_vmcs12_to_shadow",
    "nested_vmx_restore_host_state",
    "pi_enable_wakeup_handler",
    "kvm_arch_irq_bypass_del_producer"
  ],
  "Reasoning": "The patch updates runtime assertions across arch/x86/kvm (including LAPIC, nested SVM/VMX, PIT, Hyper-V emulation, TDP MMU, and IRQ handling), converting multiple WARN_ON checks to WARN_ON_ONCE and replacing preemptible checks with lockdep_assert_preemption_disabled(). KVM is fully reachable and fuzzable via /dev/kvm ioctls and guest execution on amd64 in virtualized environments. Modifying assertions and preemption invariants in reachable core subsystem code warrants fuzzing to detect if any sequence of operations can trigger them.",
  "WorthFuzzing": true
}

Results:
{
  "EnableConfigs": [
    "KVM",
    "KVM_INTEL",
    "KVM_AMD",
    "KVM_HYPERV",
    "KVM_IOAPIC",
    "KVM_AMD_SEV",
    "PROVE_LOCKING"
  ],
  "FocusSymbols": [
    "cancel_hv_timer",
    "start_hv_timer",
    "start_sw_timer",
    "kvm_lapic_expired_hv_timer",
    "kvm_lapic_restart_hv_timer",
    "hv_tlb_flush_enqueue",
    "enter_svm_guest_mode",
    "svm_set_vintr",
    "svm_clear_vintr",
    "alloc_shadow_vmcs",
    "copy_shadow_to_vmcs12",
    "copy_vmcs12_to_shadow",
    "nested_vmx_restore_host_state",
    "pi_enable_wakeup_handler",
    "kvm_arch_irq_bypass_del_producer"
  ],
  "Reasoning": "The patch updates runtime assertions across arch/x86/kvm (including LAPIC, nested SVM/VMX, PIT, Hyper-V emulation, TDP MMU, and IRQ handling), converting multiple WARN_ON checks to WARN_ON_ONCE and replacing preemptible checks with lockdep_assert_preemption_disabled(). KVM is fully reachable and fuzzable via /dev/kvm ioctls and guest execution on amd64 in virtualized environments. Modifying assertions and preemption invariants in reachable core subsystem code warrants fuzzing to detect if any sequence of operations can trigger them.",
  "WorthFuzzing": true
}

21/1 2026/10/29 08:22 action If
0m Args:
{
  "WorthFuzzing": true
}

Results:
null

22/2 2026/10/29 08:22 agent kmsan-evaluator
0m Model:
core

Args:
null

Results:
{
  "KMSANReasoning": "The patch series performs a systematic refactoring across x86 KVM code to replace unconditional warning macros (WARN_ON, WARN) with one-shot variants (WARN_ON_ONCE, WARN_ONCE) to prevent log flooding on assertion failures, and replaces WARN_ON(preemptible()) checks with lockdep_assert_preemption_disabled().\n\nNo memory allocation, deallocation, copying to user space, or data initialization logic is introduced or altered. There are no changes to control flow depending on uninitialized data, nor any new or modified data structures. The side effects within the evaluated conditions (such as kfifo_in()) remain evaluated on every call, identical to their previous behavior under WARN_ON.\n\nBecause these changes do not create, access, or expose uninitialized memory or information leaks to userspace, KMSAN is not applicable. Any potential concurrency or locking issues are handled by standard LOCKDEP / KASAN builds. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
  "NeedsKMSAN": false
}

Instruction:
You are an expert Linux kernel security engineer specializing in kernel memory
error detectors (KASAN and KMSAN). Your job is to review the provided patch series and
determine if the code changes justify spawning a dedicated KMSAN (KernelMemorySanitizer)
fuzzing session in addition to standard KASAN fuzzing.

CRITICAL DISTINCTION BETWEEN KASAN AND KMSAN:
- Standard KASAN kernel builds (upstream-apparmor-kasan.config) already enable
  a comprehensive suite of debugging tools and sanitizers, including KASAN
  (out-of-bounds accesses, use-after-free, double free, invalid free), LOCKDEP
  (locking bugs and deadlocks), UB-sanitizers, and memory corruption checks.
- KMSAN (KernelMemorySanitizer) detects reads of UNINITIALIZED memory (stack, heap,
  or page allocations) and kernel-to-user memory info-leaks.

Rule: THERE IS NO SENSE IN RUNNING A KMSAN SESSION IF A BUG CAN BE CAUGHT BY KASAN,
LOCKDEP, OR OTHER STANDARD BUG DETECTORS.
A dedicated KMSAN fuzzing session incurs significant resource costs. You must ONLY
set NeedsKMSAN=true if the code changes introduce or expose UNINITIALIZED MEMORY risks
that are detected ONLY by KMSAN.

Look holistically at the patch series and surrounding code. Even if no direct
uninitialized field accesses or new buffer allocations are added in the diff itself,
a patch may alter control flow, bounds checking, or data length calculations in ways
that change how the rest of the code operates on existing buffers (e.g. allowing
uninitialized stack/heap memory to be read, copied to user space, or used in control
flow). Do not hesitate to use your code access tools to inspect the surrounding code,
called functions, and callers.

Set NeedsKMSAN=true ONLY IF the patch introduces or modifies:
1. Kernel structures sent to user space (via copy_to_user, put_user, netlink skb
   attributes, ioctl output arguments, socket options, or BPF buffers) where fields
   or structure padding might not be fully initialized/zeroed.
2. Conditional logic or branching that depends on potentially uninitialized variables
   or struct fields.
3. Allocation or initialization of complex data structures where uninitialized fields
   could be read later in reachable code paths.
4. Bounds checks, lengths, or logic in a way that allows surrounding code to access
   uninitialized bytes of existing buffers.

Set NeedsKMSAN=false IF:
- The code changes primarily risk out-of-bounds access, array overflows, NULL pointer
  dereferences, locking deadlocks, or use-after-free bugs (these are already caught
  by KASAN, LOCKDEP, or standard bug detectors).
- All stack/heap structures touched or introduced by the patch are fully zeroed
  or initialized (e.g. using = {0}, memset, kzalloc) before being read or copied.
- The patch does not introduce any risk of uninitialized memory usage or info-leaks.

Use your code access tools to inspect the surrounding code if necessary, then provide
detailed KMSANReasoning contrasting KASAN vs KMSAN applicability for this patch.
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:
Target architecture: amd64

For your convenience, here is the diff of the changes:
commit 5ad32865239365715bdc4fe064d55fd1494ae8be
Author: syz-cluster <triage@syzkaller.com>
Date:   Thu Oct 29 08:19:33 2026 +0000

    syz-cluster: applied patch under review

diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c
index 5d2e3617c95200..d9e3d49a6cc5e1 100644
--- a/arch/x86/kvm/hyperv.c
+++ b/arch/x86/kvm/hyperv.c
@@ -1977,7 +1977,7 @@ static void hv_tlb_flush_enqueue(struct kvm_vcpu *vcpu, u64 *entries, int count,
 	 * space, just put 'flush all' entry there.
 	 */
 	if (count && entries && count < kfifo_avail(&tlb_flush_fifo->entries)) {
-		WARN_ON(kfifo_in(&tlb_flush_fifo->entries, entries, count) != count);
+		WARN_ON_ONCE(kfifo_in(&tlb_flush_fifo->entries, entries, count) != count);
 		goto out_unlock;
 	}
 
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 1982b0077ddda9..7ad8c11a1809d7 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -409,7 +409,7 @@ static void kvm_pit_load_count(struct kvm_pit *pit, int channel, u32 val,
 
 	if (hpet_legacy_start) {
 		/* save existing mode for later reenablement */
-		WARN_ON(channel != 0);
+		WARN_ON_ONCE(channel != 0);
 		saved_mode = pit->pit_state.channels[0].mode;
 		pit->pit_state.channels[0].mode = 0xff; /* disable timer */
 		pit_load_count(pit, channel, val);
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 8719772882722d..7f8b092b447950 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -128,7 +128,7 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_cpu_has_interrupt);
 int kvm_cpu_get_extint(struct kvm_vcpu *v)
 {
 	if (!kvm_cpu_has_extint(v)) {
-		WARN_ON(!lapic_in_kernel(v));
+		WARN_ON_ONCE(!lapic_in_kernel(v));
 		return -1;
 	}
 
@@ -513,7 +513,7 @@ void kvm_arch_irq_bypass_del_producer(struct irq_bypass_consumer *cons,
 	struct kvm *kvm = irqfd->kvm;
 	int ret;
 
-	WARN_ON(irqfd->producer != prod);
+	WARN_ON_ONCE(irqfd->producer != prod);
 
 	/*
 	 * If the producer of an IRQ that is currently being posted to a vCPU
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index ecf611845fb12d..08b96b124b07ee 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -2062,7 +2062,7 @@ static void apic_timer_expired(struct kvm_lapic *apic, bool from_timer_fn)
 		ktimer->expired_tscdeadline = ktimer->tscdeadline;
 
 	if (!from_timer_fn && apic->apicv_active && vcpu->wants_to_run) {
-		WARN_ON(kvm_get_running_vcpu() != vcpu);
+		WARN_ON_ONCE(kvm_get_running_vcpu() != vcpu);
 		kvm_apic_inject_pending_timer_irqs(apic);
 		return;
 	}
@@ -2270,8 +2270,9 @@ bool kvm_lapic_hv_timer_in_use(struct kvm_vcpu *vcpu)
 
 static void cancel_hv_timer(struct kvm_lapic *apic)
 {
-	WARN_ON(preemptible());
-	WARN_ON(!apic->lapic_timer.hv_timer_in_use);
+	lockdep_assert_preemption_disabled();
+
+	WARN_ON_ONCE(!apic->lapic_timer.hv_timer_in_use);
 	kvm_x86_call(cancel_hv_timer)(apic->vcpu);
 	apic->lapic_timer.hv_timer_in_use = false;
 }
@@ -2282,7 +2283,8 @@ static bool start_hv_timer(struct kvm_lapic *apic)
 	struct kvm_vcpu *vcpu = apic->vcpu;
 	bool expired;
 
-	WARN_ON(preemptible());
+	lockdep_assert_preemption_disabled();
+
 	if (!kvm_can_use_hv_timer(vcpu))
 		return false;
 
@@ -2322,7 +2324,8 @@ static void start_sw_timer(struct kvm_lapic *apic)
 {
 	struct kvm_timer *ktimer = &apic->lapic_timer;
 
-	WARN_ON(preemptible());
+	lockdep_assert_preemption_disabled();
+
 	if (apic->lapic_timer.hv_timer_in_use)
 		cancel_hv_timer(apic);
 	if (!apic_lvtt_period(apic) && atomic_read(&ktimer->pending))
@@ -2356,7 +2359,7 @@ void kvm_lapic_expired_hv_timer(struct kvm_vcpu *vcpu)
 	/* If the preempt notifier has already run, it also called apic_timer_expired */
 	if (!apic->lapic_timer.hv_timer_in_use)
 		goto out;
-	WARN_ON(kvm_vcpu_is_blocking(vcpu));
+	WARN_ON_ONCE(kvm_vcpu_is_blocking(vcpu));
 	apic_timer_expired(apic, false);
 	cancel_hv_timer(apic);
 
@@ -2389,7 +2392,7 @@ void kvm_lapic_restart_hv_timer(struct kvm_vcpu *vcpu)
 {
 	struct kvm_lapic *apic = vcpu->arch.apic;
 
-	WARN_ON(!apic->lapic_timer.hv_timer_in_use);
+	WARN_ON_ONCE(!apic->lapic_timer.hv_timer_in_use);
 	restart_apic_timer(apic);
 }
 
diff --git a/arch/x86/kvm/mmu/tdp_mmu.c b/arch/x86/kvm/mmu/tdp_mmu.c
index 44dad106fad191..9169d8dbe43c38 100644
--- a/arch/x86/kvm/mmu/tdp_mmu.c
+++ b/arch/x86/kvm/mmu/tdp_mmu.c
@@ -43,7 +43,7 @@ void kvm_mmu_uninit_tdp_mmu(struct kvm *kvm)
 #ifdef CONFIG_KVM_PROVE_MMU
 	KVM_MMU_WARN_ON(atomic64_read(&kvm->arch.tdp_mmu_pages));
 #endif
-	WARN_ON(!list_empty(&kvm->arch.tdp_mmu_roots));
+	WARN_ON_ONCE(!list_empty(&kvm->arch.tdp_mmu_roots));
 
 	/*
 	 * Ensure that all the outstanding RCU callbacks to free shadow pages
@@ -1368,7 +1368,7 @@ static bool __kvm_tdp_mmu_age_gfn_range(struct kvm *kvm,
 	 * this helper must NOT be used to unmap GFNs, as it processes only
 	 * valid roots!
 	 */
-	WARN_ON(types & ~KVM_VALID_ROOTS);
+	WARN_ON_ONCE(types & ~KVM_VALID_ROOTS);
 
 	guard(rcu)();
 	for_each_tdp_mmu_root_rcu(kvm, root, range->slot->as_id, types) {
diff --git a/arch/x86/kvm/msrs.c b/arch/x86/kvm/msrs.c
index e91650af44c207..b8ab784704faa2 100644
--- a/arch/x86/kvm/msrs.c
+++ b/arch/x86/kvm/msrs.c
@@ -643,7 +643,7 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
 
 	r = kvm_x86_call(set_efer)(vcpu, efer);
 	if (r) {
-		WARN_ON(r > 0);
+		WARN_ON_ONCE(r > 0);
 		return r;
 	}
 
diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index 3b037e3855234e..0042039e15e3f8 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -1042,7 +1042,7 @@ static void __avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu,
 
 	lockdep_assert_preemption_disabled();
 
-	if (WARN_ON(h_physical_id & ~AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK))
+	if (WARN_ON_ONCE(h_physical_id & ~AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK))
 		return;
 
 	if (WARN_ON_ONCE(vcpu->vcpu_id * sizeof(entry) >=
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index af0ef678433d72..ab66f07337b5b2 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -100,7 +100,7 @@ static void nested_svm_init_mmu_context(struct kvm_vcpu *vcpu)
 {
 	struct vcpu_svm *svm = to_svm(vcpu);
 
-	WARN_ON(mmu_is_nested(vcpu));
+	WARN_ON_ONCE(mmu_is_nested(vcpu));
 
 	vcpu->arch.mmu = &vcpu->arch.guest_mmu;
 
@@ -260,7 +260,7 @@ int __init nested_svm_init_msrpm_merge_offsets(void)
 		int bit_nr = svm_msrpm_bit_nr(merge_msrs[i]);
 		u32 offset;
 
-		if (WARN_ON(bit_nr < 0))
+		if (WARN_ON_ONCE(bit_nr < 0))
 			return -EIO;
 
 		/*
@@ -277,7 +277,7 @@ int __init nested_svm_init_msrpm_merge_offsets(void)
 		if (j < nested_svm_nr_msrpm_merge_offsets)
 			continue;
 
-		if (WARN_ON(j >= ARRAY_SIZE(nested_svm_msrpm_merge_offsets)))
+		if (WARN_ON_ONCE(j >= ARRAY_SIZE(nested_svm_msrpm_merge_offsets)))
 			return -EIO;
 
 		nested_svm_msrpm_merge_offsets[j] = offset;
@@ -1065,7 +1065,7 @@ int enter_svm_guest_mode(struct kvm_vcpu *vcpu, u64 vmcb12_gpa, bool from_vmrun)
 
 	svm->nested.vmcb12_gpa = vmcb12_gpa;
 
-	WARN_ON(svm->vmcb == svm->nested.vmcb02.ptr);
+	WARN_ON_ONCE(svm->vmcb == svm->nested.vmcb02.ptr);
 
 	nested_svm_copy_common_state(svm->vmcb01.ptr, svm->nested.vmcb02.ptr);
 
@@ -1716,7 +1716,7 @@ static void nested_svm_inject_exception_vmexit(struct kvm_vcpu *vcpu)
 			kvm_update_dr7(vcpu);
 		}
 	} else {
-		WARN_ON(ex->has_payload);
+		WARN_ON_ONCE(ex->has_payload);
 	}
 
 	nested_svm_vmexit(svm);
@@ -2123,7 +2123,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
 
 static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu)
 {
-	if (WARN_ON(!is_guest_mode(vcpu)))
+	if (WARN_ON_ONCE(!is_guest_mode(vcpu)))
 		return true;
 
 	if (is_pae_paging(vcpu)) {
diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
index 6427db390b1cd2..8cd0f153982902 100644
--- a/arch/x86/kvm/svm/sev.c
+++ b/arch/x86/kvm/svm/sev.c
@@ -3007,7 +3007,7 @@ void sev_vm_destroy(struct kvm *kvm)
 	if (!sev_guest(kvm))
 		return;
 
-	WARN_ON(!list_empty(&sev->mirror_vms));
+	WARN_ON_ONCE(!list_empty(&sev->mirror_vms));
 
 	/*
 	 * If this is a mirror VM, remove it from the owner's list of a mirrors
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 487897ef11dd6c..c8e82debb7f457 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -1598,7 +1598,7 @@ static void svm_set_vintr(struct vcpu_svm *svm)
 	/*
 	 * The following fields are ignored when AVIC is enabled
 	 */
-	WARN_ON(kvm_vcpu_apicv_activated(&svm->vcpu));
+	WARN_ON_ONCE(kvm_vcpu_apicv_activated(&svm->vcpu));
 
 	svm_set_intercept(svm, INTERCEPT_VINTR);
 
@@ -1633,8 +1633,8 @@ static void svm_clear_vintr(struct vcpu_svm *svm)
 	if (is_guest_mode(&svm->vcpu)) {
 		svm->vmcb01.ptr->control.int_ctl &= ~V_IRQ_INJECTION_BITS_MASK;
 
-		WARN_ON((svm->vmcb->control.int_ctl & V_TPR_MASK) !=
-			(svm->nested.ctl.int_ctl & V_TPR_MASK));
+		WARN_ON_ONCE((svm->vmcb->control.int_ctl & V_TPR_MASK) !=
+			     (svm->nested.ctl.int_ctl & V_TPR_MASK));
 
 		svm->vmcb->control.int_ctl |= svm->nested.ctl.int_ctl &
 			V_IRQ_INJECTION_BITS_MASK;
@@ -2666,7 +2666,7 @@ static int cr_interception(struct kvm_vcpu *vcpu)
 			err = kvm_set_cr8(vcpu, val);
 			break;
 		default:
-			WARN(1, "unhandled write to CR%d", cr);
+			WARN_ONCE(1, "unhandled write to CR%d", cr);
 			kvm_queue_exception(vcpu, UD_VECTOR);
 			return 1;
 		}
@@ -2688,7 +2688,7 @@ static int cr_interception(struct kvm_vcpu *vcpu)
 			val = kvm_get_cr8(vcpu);
 			break;
 		default:
-			WARN(1, "unhandled read from CR%d", cr);
+			WARN_ONCE(1, "unhandled read from CR%d", cr);
 			kvm_queue_exception(vcpu, UD_VECTOR);
 			return 1;
 		}
@@ -2725,7 +2725,7 @@ static int cr_trap(struct kvm_vcpu *vcpu)
 		ret = kvm_set_cr8(vcpu, new_value);
 		break;
 	default:
-		WARN(1, "unhandled CR%d write trap", cr);
+		WARN_ONCE(1, "unhandled CR%d write trap", cr);
 		kvm_queue_exception(vcpu, UD_VECTOR);
 		return 1;
 	}
diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
index 9b0bfa2f854cf9..ec3bc441a0e68f 100644
--- a/arch/x86/kvm/vmx/nested.c
+++ b/arch/x86/kvm/vmx/nested.c
@@ -515,7 +515,7 @@ static void nested_ept_new_eptp(struct kvm_vcpu *vcpu)
 
 static void nested_ept_init_mmu_context(struct kvm_vcpu *vcpu)
 {
-	WARN_ON(mmu_is_nested(vcpu));
+	WARN_ON_ONCE(mmu_is_nested(vcpu));
 
 	vcpu->arch.mmu = &vcpu->arch.guest_mmu;
 	nested_ept_new_eptp(vcpu);
@@ -1315,7 +1315,7 @@ static void nested_vmx_transition_tlb_flush(struct kvm_vcpu *vcpu,
 	}
 
 	/* L2 should never have a VPID if VPID is disabled. */
-	WARN_ON(!enable_vpid);
+	WARN_ON_ONCE(!enable_vpid);
 
 	/*
 	 * VPID is enabled and in use by vmcs12.  If vpid12 is changing, then
@@ -1698,7 +1698,7 @@ static void copy_shadow_to_vmcs12(struct vcpu_vmx *vmx)
 	unsigned long val;
 	int i;
 
-	if (WARN_ON(!shadow_vmcs))
+	if (WARN_ON_ONCE(!shadow_vmcs))
 		return;
 
 	preempt_disable();
@@ -1733,7 +1733,7 @@ static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx)
 	unsigned long val;
 	int i, q;
 
-	if (WARN_ON(!shadow_vmcs))
+	if (WARN_ON_ONCE(!shadow_vmcs))
 		return;
 
 	vmcs_load(shadow_vmcs);
@@ -4978,7 +4978,7 @@ static void nested_vmx_restore_host_state(struct kvm_vcpu *vcpu)
 		if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)
 			kvm_set_dr(vcpu, 7, DR7_FIXED_1);
 		else
-			WARN_ON(kvm_set_dr(vcpu, 7, vmcs_readl(GUEST_DR7)));
+			WARN_ON_ONCE(kvm_set_dr(vcpu, 7, vmcs_readl(GUEST_DR7)));
 	}
 
 	/* Reload DEBUGCTL to ensure vmcs01 has a fresh FREEZE_IN_SMM value. */
@@ -5408,7 +5408,7 @@ static struct vmcs *alloc_shadow_vmcs(struct kvm_vcpu *vcpu)
 	 * doesn't support virtualization of VMCS shadowing, so vmcs01 should
 	 * always be the loaded VMCS.
 	 */
-	if (WARN_ON(loaded_vmcs != &vmx->vmcs01 || loaded_vmcs->shadow_vmcs))
+	if (WARN_ON_ONCE(loaded_vmcs != &vmx->vmcs01 || loaded_vmcs->shadow_vmcs))
 		return loaded_vmcs->shadow_vmcs;
 
 	loaded_vmcs->shadow_vmcs = alloc_vmcs(true);
diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c
index 2644add54b76bc..0f508015692b4f 100644
--- a/arch/x86/kvm/vmx/posted_intr.c
+++ b/arch/x86/kvm/vmx/posted_intr.c
@@ -187,7 +187,7 @@ static void pi_enable_wakeup_handler(struct kvm_vcpu *vcpu)
 		      &per_cpu(wakeup_vcpus_on_cpu, vcpu->cpu));
 	raw_spin_unlock(&per_cpu(wakeup_vcpus_on_cpu_lock, vcpu->cpu));
 
-	WARN(pi_test_sn(pi_desc), "PI descriptor SN field set before blocking");
+	WARN_ONCE(pi_test_sn(pi_desc), "PI descriptor SN field set before blocking");
 
 	old.control = READ_ONCE(pi_desc->control);
 	do {
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index b341af4c6057a7..0038626f54868d 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -3089,7 +3089,7 @@ void free_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)
 	loaded_vmcs->vmcs = NULL;
 	if (loaded_vmcs->msr_bitmap)
 		free_page((unsigned long)loaded_vmcs->msr_bitmap);
-	WARN_ON(loaded_vmcs->shadow_vmcs != NULL);
+	WARN_ON_ONCE(loaded_vmcs->shadow_vmcs != NULL);
 }
 
 int alloc_loaded_vmcs(struct loaded_vmcs *loaded_vmcs)
@@ -4468,7 +4468,7 @@ void vmx_set_constant_host_state(struct vcpu_vmx *vmx)
 	unsigned long cr0, cr3, cr4;
 
 	cr0 = read_cr0();
-	WARN_ON(cr0 & X86_CR0_TS);
+	WARN_ON_ONCE(cr0 & X86_CR0_TS);
 	vmcs_writel(HOST_CR0, cr0);  /* 22.2.3 */
 
 	/*
@@ -5537,7 +5537,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu)
 			 * STI and MOVSS blocking.
 			 */
 			if (is_icebp(intr_info))
-				WARN_ON(!skip_emulated_instruction(vcpu));
+				WARN_ON_ONCE(!skip_emulated_instruction(vcpu));
 
 			kvm_queue_exception_p(vcpu, DB_VECTOR, dr6);
 			return 1;
@@ -5962,7 +5962,7 @@ static int handle_task_switch(struct kvm_vcpu *vcpu)
 	if (!idt_v || (type != INTR_TYPE_HARD_EXCEPTION &&
 		       type != INTR_TYPE_EXT_INTR &&
 		       type != INTR_TYPE_NMI_INTR))
-		WARN_ON(!skip_emulated_instruction(vcpu));
+		WARN_ON_ONCE(!skip_emulated_instruction(vcpu));
 
 	/*
 	 * TODO: What about debug traps on tss switch?
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 32563a91fba99a..a9be847d3cc2cc 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -370,7 +370,7 @@ static int exception_type(int vector)
 {
 	unsigned int mask;
 
-	if (WARN_ON(vector > 31 || vector == NMI_VECTOR))
+	if (WARN_ON_ONCE(vector > 31 || vector == NMI_VECTOR))
 		return EXCPT_INTERRUPT;
 
 	mask = 1 << vector;
@@ -4907,7 +4907,7 @@ static int kvm_fetch_guest_virt(struct x86_emulate_ctxt *ctxt,
 		return X86EMUL_PROPAGATE_FAULT;
 
 	offset = addr & (PAGE_SIZE-1);
-	if (WARN_ON(offset + bytes > PAGE_SIZE))
+	if (WARN_ON_ONCE(offset + bytes > PAGE_SIZE))
 		bytes = (unsigned)PAGE_SIZE - offset;
 	ret = kvm_vcpu_read_guest_page(vcpu, gpa >> PAGE_SHIFT, val,
 				       offset, bytes);
@@ -5167,7 +5167,7 @@ static int emulator_read_write_onepage(unsigned long addr, void *val,
 	bytes -= handled;
 	val += handled;
 
-	WARN_ON(vcpu->mmio_nr_fragments >= KVM_MAX_MMIO_FRAGMENTS);
+	WARN_ON_ONCE(vcpu->mmio_nr_fragments >= KVM_MAX_MMIO_FRAGMENTS);
 	frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++];
 	frag->gpa = gpa;
 	if (write && bytes <= 8u) {
@@ -7042,7 +7042,7 @@ static int kvm_x86_check_processor_compatibility(void)
 	 * compatible, i.e. KVM should never perform a compatibility check on
 	 * an offline CPU.
 	 */
-	WARN_ON(!cpu_online(cpu));
+	WARN_ON_ONCE(!cpu_online(cpu));
 
 	if (__cr4_reserved_bits(cpu_has, c) !=
 	    __cr4_reserved_bits(cpu_has, &boot_cpu_data))
@@ -7783,7 +7783,7 @@ static int kvm_check_and_inject_events(struct kvm_vcpu *vcpu,
 			vcpu->arch.nmi_injected = true;
 			kvm_x86_call(inject_nmi)(vcpu);
 			can_inject = false;
-			WARN_ON(kvm_x86_call(nmi_allowed)(vcpu, true) < 0);
+			WARN_ON_ONCE(kvm_x86_call(nmi_allowed)(vcpu, true) < 0);
 		}
 		if (vcpu->arch.nmi_pending)
 			kvm_x86_call(enable_nmi_window)(vcpu);
@@ -7800,7 +7800,7 @@ static int kvm_check_and_inject_events(struct kvm_vcpu *vcpu,
 			if (likely(irq != -1)) {
 				kvm_queue_interrupt(vcpu, irq, false);
 				kvm_x86_call(inject_irq)(vcpu, false);
-				WARN_ON(kvm_x86_call(interrupt_allowed)(vcpu, true) < 0);
+				WARN_ON_ONCE(kvm_x86_call(interrupt_allowed)(vcpu, true) < 0);
 			} else {
 				kvm_warn_on_lost_irq(vcpu);
 			}
@@ -8470,8 +8470,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 	 * KVM_DEBUGREG_WONT_EXIT again.
 	 */
 	if (unlikely(vcpu->arch.switch_db_regs & KVM_DEBUGREG_WONT_EXIT)) {
-		WARN_ON(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP);
-		WARN_ON(vcpu->arch.switch_db_regs & KVM_DEBUGREG_AUTO_SWITCH);
+		WARN_ON_ONCE(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP);
+		WARN_ON_ONCE(vcpu->arch.switch_db_regs & KVM_DEBUGREG_AUTO_SWITCH);
 		kvm_x86_call(sync_dirty_debug_regs)(vcpu);
 		kvm_update_dr0123(vcpu);
 		vcpu->arch.dr6 |= kvm_get_dr6_fixed_1(vcpu);
@@ -10038,7 +10038,7 @@ void __user * __x86_set_memory_region(struct kvm *kvm, int id, gpa_t gpa,
 
 	lockdep_assert_held(&kvm->slots_lock);
 
-	if (WARN_ON(id >= KVM_MEM_SLOTS_NUM))
+	if (WARN_ON_ONCE(id >= KVM_MEM_SLOTS_NUM))
 		return ERR_PTR_USR(-EINVAL);
 
 	slot = id_to_memslot(slots, id);
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index cfe96962a4e48d..99ba31aa5ef5bc 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -348,7 +348,7 @@ static inline void adjust_tsc_offset_guest(struct kvm_vcpu *vcpu,
 static inline void adjust_tsc_offset_host(struct kvm_vcpu *vcpu, s64 adjustment)
 {
 	if (vcpu->arch.l1_tsc_scaling_ratio != kvm_caps.default_tsc_scaling_ratio)
-		WARN_ON(adjustment < 0);
+		WARN_ON_ONCE(adjustment < 0);
 	adjustment = kvm_scale_tsc((u64) adjustment,
 				   vcpu->arch.l1_tsc_scaling_ratio);
 	adjust_tsc_offset_guest(vcpu, adjustment);

23/3 2026/10/29 08:22 llm kmsan-evaluator
0m Model:
gemini-3.8-flash

Args:
null

Results:
null

Tokens:
							input: 10472
							output: 238
							thoughts: 1812
						

Thoughts:
**KVM x86 Patch Review: Assessing KMSAN Needs**

Okay, let's take a look at this x86 KVM patch series. The primary goal seems to be a bit of code hardening and cleanup. It's primarily a matter of converting a bunch of `WARN_ON(...)` calls to `WARN_ON_ONCE(...)`, `WARN(...)` to `WARN_ONCE(...)`, and `WARN_ON(preemptible())` constructs to `lockdep_assert_preemption_disabled()`. A quick skim of the changes confirms this: a pervasive substitution across various KVM files like `hyperv.c`, `i8254.c`, `irq.c`, `lapic.c`, `tdp_mmu.c`, `msrs.c`, `avic.c`, `nested.c`, `sev.c`, `svm.c`, `vmx.c`, and `x86.c`, including the related `.h` files.

Specifically, I need to focus on potential memory safety implications. Looking at `hyperv.c` as an example, while a `WARN_ON_ONCE` now encompasses `kfifo_in`, the condition itself is still evaluated, which is confirmed by the definition of `WARN_ON_ONCE` in the kernel.

Now, the crucial question: does this patch introduce any new risks related to uninitialized memory? No. I see no memory allocations, no reads of uninitialized variables, no transfer of data to userspace, and no modifications to buffer sizes or length checks in a way that could introduce an uninitialized memory exposure. It's strictly a macro conversion, or substitution, to the rate-limited variants of the existing assertions.

Therefore, the patch doesn't introduce any new code paths that would expose uninitialized memory.

Let's apply the KMSAN rules. The rule says that running KMSAN is only warranted if the code changes expose uninitialized memory risks that would only be detected by KMSAN. Given that the changes don't introduce any risk of uninitialized memory use or info-leaks, KMSAN is not necessary here. Other standard bug detectors like KASAN and LOCKDEP are fully appropriate to catch the sorts of bugs that might arise in KVM. No stack/heap structures touched or introduced by the patch are not zeroed or initialized. There is not a single code change that introduces or exposes UNINITIALIZED MEMORY risks.

Therefore, `NeedsKMSAN = false`. I'm confident in calling this decision, and it's time to communicate it clearly:

*   **Patch Description:** The patch is a cleanup and hardening exercise within x86 KVM. It refactors non-fatal assertion macros (`WARN_ON`, `WARN`) to rate-limited / one-time warnings (`WARN_ON_ONCE`, `WARN_ONCE`). It also standardizes the preemption assertions by converting `WARN_ON(preemptible())` calls to `lockdep_assert_preemption_disabled()`.
*   **Memory Initialization Analysis:** The patch contains no new memory allocations, no buffer manipulations, no transfer of data to userspace, no changes to struct initializations or variable definitions, and no branching based on uninitialized memory. Therefore, no memory initialization semantics or buffer data flows are altered.
*   **KMSAN vs. KASAN Contrast:** KMSAN specifically detects uninitialized memory reads and kernel-to-user information leaks. Since the patch doesn't introduce these risks, KMSAN is not relevant here. KASAN and LOCKDEP, however, are sufficient, and cover existing memory safety, locking assertions (preemption assertions via lockdep) are appropriate here. Given that KMSAN would be superfluous, an intensive KMSAN fuzzing session is not warranted.

Okay, let's submit my assessment.



24/3 2026/10/29 08:22 tool set-results
0m Args:
{
  "KMSANReasoning": "The patch series performs a systematic refactoring across x86 KVM code to replace unconditional warning macros (WARN_ON, WARN) with one-shot variants (WARN_ON_ONCE, WARN_ONCE) to prevent log flooding on assertion failures, and replaces WARN_ON(preemptible()) checks with lockdep_assert_preemption_disabled().\n\nNo memory allocation, deallocation, copying to user space, or data initialization logic is introduced or altered. There are no changes to control flow depending on uninitialized data, nor any new or modified data structures. The side effects within the evaluated conditions (such as kfifo_in()) remain evaluated on every call, identical to their previous behavior under WARN_ON.\n\nBecause these changes do not create, access, or expose uninitialized memory or information leaks to userspace, KMSAN is not applicable. Any potential concurrency or locking issues are handled by standard LOCKDEP / KASAN builds. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
  "NeedsKMSAN": false
}

Results:
{
  "KMSANReasoning": "The patch series performs a systematic refactoring across x86 KVM code to replace unconditional warning macros (WARN_ON, WARN) with one-shot variants (WARN_ON_ONCE, WARN_ONCE) to prevent log flooding on assertion failures, and replaces WARN_ON(preemptible()) checks with lockdep_assert_preemption_disabled().\n\nNo memory allocation, deallocation, copying to user space, or data initialization logic is introduced or altered. There are no changes to control flow depending on uninitialized data, nor any new or modified data structures. The side effects within the evaluated conditions (such as kfifo_in()) remain evaluated on every call, identical to their previous behavior under WARN_ON.\n\nBecause these changes do not create, access, or expose uninitialized memory or information leaks to userspace, KMSAN is not applicable. Any potential concurrency or locking issues are handled by standard LOCKDEP / KASAN builds. Therefore, a dedicated KMSAN fuzzing session is not warranted.",
  "NeedsKMSAN": false
}

LLM Calls Summary:
Total Calls Total Tokens Avg Tokens Total Duration (Seconds) Avg Duration (Seconds)
Tool Calls Summary:
Total Calls Total Duration (Seconds) Avg Duration (Seconds)