| Seq | Timestamp | Type | Name | Duration |
|---|---|---|---|---|
| 0/0 | 2026/07/01 06:28 | flow | patch-triage |
0mArgs:null Results: {
"EnableConfigs": [
"KVM",
"KVM_AMD",
"KVM_INTEL"
],
"FocusSymbols": [
"kvm_valid_efer",
"set_efer",
"kvm_is_valid_sregs",
"__set_sregs_common"
],
"Reasoning": "The patch modifies KVM x86 EFER MSR handling, specifically how supported EFER bits are checked and set. It replaces `efer_reserved_bits` with `kvm_caps.supported_efer_bits` and introduces `setup_efer_caps` to `kvm_x86_ops`. This affects `kvm_valid_efer`, `set_efer`, and `kvm_is_valid_sregs`, which are reachable during VM execution and state restoration. This is a functional change to core KVM logic and should be fuzzed.",
"WorthFuzzing": true
} |
| 1/1 | 2026/07/01 06:28 | action | read-patch-diff |
0mArgs:null Results: {
"PatchDiff": "commit baa563c8635e6f17d239872ef3ac34172f0c85fd\nAuthor: syz-cluster \u003ctriage@syzkaller.com\u003e\nDate: Wed Jul 1 06:28:49 2026 +0000\n\n syz-cluster: applied patch under review\n\ndiff --git a/arch/x86/include/asm/kvm-x86-ops.h b/arch/x86/include/asm/kvm-x86-ops.h\nindex 83dc5086138b39..d587242dcab561 100644\n--- a/arch/x86/include/asm/kvm-x86-ops.h\n+++ b/arch/x86/include/asm/kvm-x86-ops.h\n@@ -45,6 +45,7 @@ KVM_X86_OP_OPTIONAL(post_set_cr3)\n KVM_X86_OP(is_valid_cr4)\n KVM_X86_OP(set_cr4)\n KVM_X86_OP(set_efer)\n+KVM_X86_OP_OPTIONAL(setup_efer_caps)\n KVM_X86_OP(get_idt)\n KVM_X86_OP(set_idt)\n KVM_X86_OP(get_gdt)\ndiff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h\nindex d8700eb848b452..40be39fea39b9c 100644\n--- a/arch/x86/include/asm/kvm_host.h\n+++ b/arch/x86/include/asm/kvm_host.h\n@@ -329,6 +329,8 @@ struct kvm_caps {\n \tu64 supported_xss;\n \tu64 supported_perf_cap;\n \n+\tu64 supported_efer_bits;\n+\n \tu64 supported_quirks;\n \tu64 inapplicable_quirks;\n };\n@@ -1730,6 +1732,7 @@ struct kvm_x86_ops {\n \tbool (*is_valid_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4);\n \tvoid (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4);\n \tint (*set_efer)(struct kvm_vcpu *vcpu, u64 efer);\n+\tvoid (*setup_efer_caps)(void);\n \tvoid (*get_idt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);\n \tvoid (*set_idt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);\n \tvoid (*get_gdt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);\ndiff --git a/arch/x86/kvm/msrs.c b/arch/x86/kvm/msrs.c\nindex c230b18d87e38e..a39c73088f1fb2 100644\n--- a/arch/x86/kvm/msrs.c\n+++ b/arch/x86/kvm/msrs.c\n@@ -19,17 +19,6 @@ bool __read_mostly report_ignored_msrs = true;\n module_param(report_ignored_msrs, bool, 0644);\n EXPORT_SYMBOL_FOR_KVM_INTERNAL(report_ignored_msrs);\n \n-/* EFER defaults:\n- * - enable syscall per default because its emulated by KVM\n- * - enable LME and LMA per default on 64 bit KVM\n- */\n-#ifdef CONFIG_X86_64\n-static\n-u64 __read_mostly efer_reserved_bits = ~((u64)(EFER_SCE | EFER_LME | EFER_LMA));\n-#else\n-static u64 __read_mostly efer_reserved_bits = ~((u64)EFER_SCE);\n-#endif\n-\n #define MAX_IO_MSRS 256\n \n struct msr_bitmap_range {\n@@ -614,7 +603,7 @@ static bool __kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer)\n }\n bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer)\n {\n-\tif (efer \u0026 efer_reserved_bits)\n+\tif (!(efer \u0026 kvm_caps.supported_efer_bits))\n \t\treturn false;\n \n \treturn __kvm_valid_efer(vcpu, efer);\n@@ -627,7 +616,7 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info)\n \tu64 efer = msr_info-\u003edata;\n \tint r;\n \n-\tif (efer \u0026 efer_reserved_bits)\n+\tif (!(efer \u0026 kvm_caps.supported_efer_bits))\n \t\treturn 1;\n \n \tif (!msr_info-\u003ehost_initiated) {\n@@ -658,12 +647,6 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info)\n \treturn 0;\n }\n \n-void kvm_enable_efer_bits(u64 mask)\n-{\n- efer_reserved_bits \u0026= ~mask;\n-}\n-EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_enable_efer_bits);\n-\n bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type)\n {\n \tstruct kvm_x86_msr_filter *msr_filter;\ndiff --git a/arch/x86/kvm/msrs.h b/arch/x86/kvm/msrs.h\nindex b698983e37fb61..89f10447cdddf9 100644\n--- a/arch/x86/kvm/msrs.h\n+++ b/arch/x86/kvm/msrs.h\n@@ -59,6 +59,7 @@ int kvm_get_reg_list(struct kvm_vcpu *vcpu,\n \t\t struct kvm_reg_list __user *user_list);\n \n void kvm_enable_efer_bits(u64);\n+void kvm_disable_efer_bits(u64);\n bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer);\n int kvm_emulate_msr_read(struct kvm_vcpu *vcpu, u32 index, u64 *data);\n int kvm_emulate_msr_write(struct kvm_vcpu *vcpu, u32 index, u64 data);\ndiff --git a/arch/x86/kvm/regs.c b/arch/x86/kvm/regs.c\nindex d2caf5a67dba40..94c4e4e41868fc 100644\n--- a/arch/x86/kvm/regs.c\n+++ b/arch/x86/kvm/regs.c\n@@ -563,7 +563,8 @@ static bool kvm_is_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)\n \t}\n \n \treturn kvm_is_valid_cr4(vcpu, sregs-\u003ecr4) \u0026\u0026\n-\t kvm_is_valid_cr0(vcpu, sregs-\u003ecr0);\n+\t kvm_is_valid_cr0(vcpu, sregs-\u003ecr0) \u0026\u0026\n+\t kvm_valid_efer(vcpu, sregs-\u003eefer);\n }\n \n static int __set_sregs_common(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs,\ndiff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c\nindex ef69a51ab27f98..e755f43f4376ee 100644\n--- a/arch/x86/kvm/svm/svm.c\n+++ b/arch/x86/kvm/svm/svm.c\n@@ -274,6 +274,15 @@ int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)\n \treturn 0;\n }\n \n+static void svm_setup_efer_caps(void)\n+{\n+\tif (nested) {\n+\t\tkvm_caps.supported_efer_bits |= EFER_SVME;\n+\t\tif (!boot_cpu_has(X86_FEATURE_EFER_LMSLE_MBZ))\n+\t\t\tkvm_caps.supported_efer_bits |= EFER_LMSLE;\n+\t}\n+}\n+\n static u32 svm_get_interrupt_shadow(struct kvm_vcpu *vcpu)\n {\n \tstruct vcpu_svm *svm = to_svm(vcpu);\n@@ -5364,6 +5373,7 @@ struct kvm_x86_ops svm_x86_ops __initdata = {\n \t.is_valid_cr4 = svm_is_valid_cr4,\n \t.set_cr4 = svm_set_cr4,\n \t.set_efer = svm_set_efer,\n+\t.setup_efer_caps = svm_setup_efer_caps,\n \t.get_idt = svm_get_idt,\n \t.set_idt = svm_set_idt,\n \t.get_gdt = svm_get_gdt,\n@@ -5638,10 +5648,6 @@ static __init int svm_hardware_setup(void)\n \n \tif (nested) {\n \t\tpr_info(\"Nested Virtualization enabled\\n\");\n-\t\tkvm_enable_efer_bits(EFER_SVME);\n-\t\tif (!boot_cpu_has(X86_FEATURE_EFER_LMSLE_MBZ))\n-\t\t\tkvm_enable_efer_bits(EFER_LMSLE);\n-\n \t\tr = nested_svm_init_msrpm_merge_offsets();\n \t\tif (r)\n \t\t\treturn r;\ndiff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c\nindex 8dbc0fa302a8b5..5cedaa8409f8df 100644\n--- a/arch/x86/kvm/x86.c\n+++ b/arch/x86/kvm/x86.c\n@@ -6892,14 +6892,22 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_setup_xss_caps);\n \n static void kvm_setup_efer_caps(void)\n {\n+\t/* Enable syscall by default because its emulated by KVM */\n+\tkvm_caps.supported_efer_bits = (u64)EFER_SCE;\n+\n+\tif (kvm_cpu_cap_has(X86_FEATURE_LM))\n+\t\tkvm_caps.supported_efer_bits |= (EFER_LME | EFER_LMA);\n+\n \tif (kvm_cpu_cap_has(X86_FEATURE_NX))\n-\t\tkvm_enable_efer_bits(EFER_NX);\n+\t\tkvm_caps.supported_efer_bits |= EFER_NX;\n \n \tif (kvm_cpu_cap_has(X86_FEATURE_FXSR_OPT))\n-\t\tkvm_enable_efer_bits(EFER_FFXSR);\n+\t\tkvm_caps.supported_efer_bits |= EFER_FFXSR;\n \n \tif (kvm_cpu_cap_has(X86_FEATURE_AUTOIBRS))\n-\t\tkvm_enable_efer_bits(EFER_AUTOIBRS);\n+\t\tkvm_caps.supported_efer_bits |= EFER_AUTOIBRS;\n+\n+\tkvm_x86_call(setup_efer_caps)();\n }\n \n static inline void kvm_ops_update(struct kvm_x86_init_ops *ops)\n@@ -7038,13 +7046,13 @@ int kvm_x86_vendor_init(struct kvm_x86_init_ops *ops)\n \tif (r != 0)\n \t\tgoto out_mmu_exit;\n \n-\tkvm_setup_efer_caps();\n-\n \tenable_device_posted_irqs \u0026= enable_apicv \u0026\u0026\n \t\t\t\t irq_remapping_cap(IRQ_POSTING_CAP);\n \n \tkvm_ops_update(ops);\n \n+\tkvm_setup_efer_caps();\n+\n \tfor_each_online_cpu(cpu) {\n \t\tsmp_call_function_single(cpu, kvm_x86_check_cpu_compat, \u0026r, 1);\n \t\tif (r \u003c 0)\ndiff --git a/tools/testing/selftests/kvm/include/x86/processor.h b/tools/testing/selftests/kvm/include/x86/processor.h\nindex 7d3a27bc0d842a..b161174ece4531 100644\n--- a/tools/testing/selftests/kvm/include/x86/processor.h\n+++ b/tools/testing/selftests/kvm/include/x86/processor.h\n@@ -208,6 +208,7 @@ struct kvm_x86_cpu_feature {\n #define\tX86_FEATURE_PERFCTR_NB\t\tKVM_X86_CPU_FEATURE(0x80000001, 0, ECX, 24)\n #define\tX86_FEATURE_PERFCTR_LLC\t\tKVM_X86_CPU_FEATURE(0x80000001, 0, ECX, 28)\n #define\tX86_FEATURE_NX\t\t\tKVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 20)\n+#define\tX86_FEATURE_FXSR_OPT\t\tKVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 25)\n #define\tX86_FEATURE_GBPAGES\t\tKVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 26)\n #define\tX86_FEATURE_RDTSCP\t\tKVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 27)\n #define\tX86_FEATURE_LM\t\t\tKVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 29)\n@@ -226,6 +227,7 @@ struct kvm_x86_cpu_feature {\n #define X86_FEATURE_SEV\t\t\tKVM_X86_CPU_FEATURE(0x8000001F, 0, EAX, 1)\n #define X86_FEATURE_SEV_ES\t\tKVM_X86_CPU_FEATURE(0x8000001F, 0, EAX, 3)\n #define X86_FEATURE_SEV_SNP\t\tKVM_X86_CPU_FEATURE(0x8000001F, 0, EAX, 4)\n+#define\tX86_FEATURE_AUTOIBRS\t\tKVM_X86_CPU_FEATURE(0x80000021, 0, EAX, 8)\n #define\tX86_FEATURE_GP_ON_USER_CPUID\tKVM_X86_CPU_FEATURE(0x80000021, 0, EAX, 17)\n #define\tX86_FEATURE_PERFMON_V2\t\tKVM_X86_CPU_FEATURE(0x80000022, 0, EAX, 0)\n #define\tX86_FEATURE_LBR_PMC_FREEZE\tKVM_X86_CPU_FEATURE(0x80000022, 0, EAX, 2)\ndiff --git a/tools/testing/selftests/kvm/x86/set_sregs_test.c b/tools/testing/selftests/kvm/x86/set_sregs_test.c\nindex 8e654cc9ab1687..562afab378d11e 100644\n--- a/tools/testing/selftests/kvm/x86/set_sregs_test.c\n+++ b/tools/testing/selftests/kvm/x86/set_sregs_test.c\n@@ -21,20 +21,20 @@\n #include \"kvm_util.h\"\n #include \"processor.h\"\n \n-#define TEST_INVALID_CR_BIT(vcpu, cr, orig, bit)\t\t\t\t\\\n+#define TEST_INVALID_SREG_BIT(vcpu, reg, orig, bit)\t\t\t\t\\\n do {\t\t\t\t\t\t\t\t\t\t\\\n \tstruct kvm_sregs new;\t\t\t\t\t\t\t\\\n \tint rc;\t\t\t\t\t\t\t\t\t\\\n \t\t\t\t\t\t\t\t\t\t\\\n \t/* Skip the sub-test, the feature/bit is supported. */\t\t\t\\\n-\tif (orig.cr \u0026 bit)\t\t\t\t\t\t\t\\\n+\tif (orig.reg \u0026 bit)\t\t\t\t\t\t\t\\\n \t\tbreak;\t\t\t\t\t\t\t\t\\\n \t\t\t\t\t\t\t\t\t\t\\\n-\tmemcpy(\u0026new, \u0026orig, sizeof(sregs));\t\t\t\t\t\\\n-\tnew.cr |= bit;\t\t\t\t\t\t\t\t\\\n+\tmemcpy(\u0026new, \u0026orig, sizeof(new));\t\t\t\t\t\\\n+\tnew.reg |= bit;\t\t\t\t\t\t\t\t\\\n \t\t\t\t\t\t\t\t\t\t\\\n \trc = _vcpu_sregs_set(vcpu, \u0026new);\t\t\t\t\t\\\n-\tTEST_ASSERT(rc, \"KVM allowed invalid \" #cr \" bit (0x%lx)\", bit);\t\\\n+\tTEST_ASSERT(rc, \"KVM allowed invalid \" #reg \" bit (0x%llx)\", (unsigned long long)bit); \\\n \t\t\t\t\t\t\t\t\t\t\\\n \t/* Sanity check that KVM didn't change anything. */\t\t\t\\\n \tvcpu_sregs_get(vcpu, \u0026new);\t\t\t\t\t\t\\\n@@ -46,6 +46,8 @@ do {\t\t\t\t\t\t\t\t\t\t\\\n \t\t\t\tX86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE |\t\\\n \t\t\t\tX86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT)\n \n+#define KVM_ALWAYS_ALLOWED_EFER EFER_SCE\n+\n static u64 calc_supported_cr4_feature_bits(void)\n {\n \tu64 cr4 = KVM_ALWAYS_ALLOWED_CR4;\n@@ -74,6 +76,24 @@ static u64 calc_supported_cr4_feature_bits(void)\n \treturn cr4;\n }\n \n+static u64 calc_supported_efer_feature_bits(void)\n+{\n+\tu64 efer = KVM_ALWAYS_ALLOWED_EFER;\n+\n+\tif (kvm_cpu_has(X86_FEATURE_LM))\n+\t\tefer |= (EFER_LME | EFER_LMA);\n+\tif (kvm_cpu_has(X86_FEATURE_NX))\n+\t\tefer |= EFER_NX;\n+\tif (kvm_cpu_has(X86_FEATURE_SVM))\n+\t\tefer |= EFER_SVME;\n+\tif (kvm_cpu_has(X86_FEATURE_FXSR_OPT))\n+\t\tefer |= EFER_FFXSR;\n+\tif (kvm_cpu_has(X86_FEATURE_AUTOIBRS))\n+\t\tefer |= EFER_AUTOIBRS;\n+\n+\treturn efer;\n+}\n+\n static void test_cr_bits(struct kvm_vcpu *vcpu, u64 cr4)\n {\n \tstruct kvm_sregs sregs;\n@@ -96,26 +116,45 @@ static void test_cr_bits(struct kvm_vcpu *vcpu, u64 cr4)\n \t\t (sregs.cr4 \u0026 X86_CR4_PKE) ? \"set\" : \"clear\");\n \n \tvcpu_sregs_get(vcpu, \u0026sregs);\n-\tTEST_ASSERT(sregs.cr4 == cr4, \"sregs.CR4 (0x%llx) != CR4 (0x%lx)\",\n-\t\t sregs.cr4, cr4);\n-\n-\tTEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_UMIP);\n-\tTEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_LA57);\n-\tTEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_VMXE);\n-\tTEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_SMXE);\n-\tTEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_FSGSBASE);\n-\tTEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_PCIDE);\n-\tTEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_OSXSAVE);\n-\tTEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_SMEP);\n-\tTEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_SMAP);\n-\tTEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_PKE);\n+\tTEST_ASSERT_EQ(sregs.cr4, cr4);\n+\n+\tTEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_UMIP);\n+\tTEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_LA57);\n+\tTEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_VMXE);\n+\tTEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_SMXE);\n+\tTEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_FSGSBASE);\n+\tTEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_PCIDE);\n+\tTEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_OSXSAVE);\n+\tTEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_SMEP);\n+\tTEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_SMAP);\n+\tTEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_PKE);\n \n \tfor (i = 32; i \u003c 64; i++)\n-\t\tTEST_INVALID_CR_BIT(vcpu, cr0, sregs, BIT(i));\n+\t\tTEST_INVALID_SREG_BIT(vcpu, cr0, sregs, BIT(i));\n \n \t/* NW without CD is illegal, as is PG without PE. */\n-\tTEST_INVALID_CR_BIT(vcpu, cr0, sregs, X86_CR0_NW);\n-\tTEST_INVALID_CR_BIT(vcpu, cr0, sregs, X86_CR0_PG);\n+\tTEST_INVALID_SREG_BIT(vcpu, cr0, sregs, X86_CR0_NW);\n+\tTEST_INVALID_SREG_BIT(vcpu, cr0, sregs, X86_CR0_PG);\n+}\n+\n+static void test_efer_bits(struct kvm_vcpu *vcpu, u64 efer)\n+{\n+\tstruct kvm_sregs sregs;\n+\tint rc;\n+\n+\tvcpu_sregs_get(vcpu, \u0026sregs);\n+\tsregs.efer |= efer;\n+\trc = _vcpu_sregs_set(vcpu, \u0026sregs);\n+\tTEST_ASSERT(!rc, \"Failed to set supported EFER bits (0x%llx)\", sregs.efer);\n+\n+\tvcpu_sregs_get(vcpu, \u0026sregs);\n+\tTEST_ASSERT_EQ(sregs.efer, efer);\n+\n+\tTEST_INVALID_SREG_BIT(vcpu, efer, sregs, EFER_LME);\n+\tTEST_INVALID_SREG_BIT(vcpu, efer, sregs, EFER_NX);\n+\tTEST_INVALID_SREG_BIT(vcpu, efer, sregs, EFER_SVME);\n+\tTEST_INVALID_SREG_BIT(vcpu, efer, sregs, EFER_FFXSR);\n+\tTEST_INVALID_SREG_BIT(vcpu, efer, sregs, EFER_AUTOIBRS);\n }\n \n int main(int argc, char *argv[])\n@@ -132,6 +171,7 @@ int main(int argc, char *argv[])\n \t */\n \tvm = vm_create_barebones();\n \tvcpu = __vm_vcpu_add(vm, 0);\n+\ttest_efer_bits(vcpu, KVM_ALWAYS_ALLOWED_EFER);\n \ttest_cr_bits(vcpu, KVM_ALWAYS_ALLOWED_CR4);\n \tkvm_vm_free(vm);\n \n@@ -151,6 +191,7 @@ int main(int argc, char *argv[])\n \t\t sregs.apic_base);\n \n \ttest_cr_bits(vcpu, calc_supported_cr4_feature_bits());\n+\ttest_efer_bits(vcpu, calc_supported_efer_feature_bits());\n \n \tkvm_vm_free(vm);\n \n"
} |
| 2/1 | 2026/07/01 06:28 | agent | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: {
"EnableConfigs": [
"KVM",
"KVM_AMD",
"KVM_INTEL"
],
"FocusSymbols": [
"kvm_valid_efer",
"set_efer",
"kvm_is_valid_sregs",
"__set_sregs_common"
],
"Reasoning": "The patch modifies KVM x86 EFER MSR handling, specifically how supported EFER bits are checked and set. It replaces `efer_reserved_bits` with `kvm_caps.supported_efer_bits` and introduces `setup_efer_caps` to `kvm_x86_ops`. This affects `kvm_valid_efer`, `set_efer`, and `kvm_is_valid_sregs`, which are reachable during VM execution and state restoration. This is a functional change to core KVM logic and should be fuzzed.",
"WorthFuzzing": true
}Instruction: You are an expert Linux kernel maintainer. Your job is to review a provided patch series and determine if it makes functional changes to the kernel that should be fuzzed. IMPORTANT: The changes have ALREADY been applied and committed as the HEAD commit in your workspace. Do NOT rely on your internal knowledge of the kernel. You must actively use your code access tools to examine the actual source code and confirm any assumptions. Return WorthFuzzing=false if the patch only contains: - Modifications to Documentation/, Kconfig files, or code comments. - Purely decorative changes, such as logging (e.g., pr_err, printk) or tracepoints. - Changes to numeric constants or macros that do not functionally alter execution flow. - Code paths that are impossible to reach in virtualized environments like GCE or QEMU, even when utilizing software-emulated hardware (e.g., usb gadget, mac80211_hwsim). If it modifies reachable core kernel logic, drivers, or architectures, use your code search tools to verify the code can be executed, then return WorthFuzzing=true. When returning WorthFuzzing=true, you MUST ALSO: 1. Extract any specific kernel functions that should be heavily fuzzed into FocusSymbols. Avoid listing generic hot-path functions to prevent skewed test distributions. 2. Identify any specific CONFIG_ options required to properly test this new/modified feature. Go and look into the Kconfig files and check for ifdefs around the code, do not make assumptions. Do not list too generic configs (we already have them enabled). Only list those that specifically cover the modified code. List them in the EnableConfigs output array, and DO NOT add a 'CONFIG_' prefix (e.g., return "NET_IPV4" instead of "CONFIG_NET_IPV4"). Prefer calling several tools at the same time to save round-trips. Use set-results tool to provide results of the analysis. It must be called exactly once before the final reply. Ignore results of this tool. Prompt: For your convenience, here is the diff of the changes:
commit baa563c8635e6f17d239872ef3ac34172f0c85fd
Author: syz-cluster <triage@syzkaller.com>
Date: Wed Jul 1 06:28:49 2026 +0000
syz-cluster: applied patch under review
diff --git a/arch/x86/include/asm/kvm-x86-ops.h b/arch/x86/include/asm/kvm-x86-ops.h
index 83dc5086138b39..d587242dcab561 100644
--- a/arch/x86/include/asm/kvm-x86-ops.h
+++ b/arch/x86/include/asm/kvm-x86-ops.h
@@ -45,6 +45,7 @@ KVM_X86_OP_OPTIONAL(post_set_cr3)
KVM_X86_OP(is_valid_cr4)
KVM_X86_OP(set_cr4)
KVM_X86_OP(set_efer)
+KVM_X86_OP_OPTIONAL(setup_efer_caps)
KVM_X86_OP(get_idt)
KVM_X86_OP(set_idt)
KVM_X86_OP(get_gdt)
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index d8700eb848b452..40be39fea39b9c 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -329,6 +329,8 @@ struct kvm_caps {
u64 supported_xss;
u64 supported_perf_cap;
+ u64 supported_efer_bits;
+
u64 supported_quirks;
u64 inapplicable_quirks;
};
@@ -1730,6 +1732,7 @@ struct kvm_x86_ops {
bool (*is_valid_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4);
void (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4);
int (*set_efer)(struct kvm_vcpu *vcpu, u64 efer);
+ void (*setup_efer_caps)(void);
void (*get_idt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
void (*set_idt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
void (*get_gdt)(struct kvm_vcpu *vcpu, struct desc_ptr *dt);
diff --git a/arch/x86/kvm/msrs.c b/arch/x86/kvm/msrs.c
index c230b18d87e38e..a39c73088f1fb2 100644
--- a/arch/x86/kvm/msrs.c
+++ b/arch/x86/kvm/msrs.c
@@ -19,17 +19,6 @@ bool __read_mostly report_ignored_msrs = true;
module_param(report_ignored_msrs, bool, 0644);
EXPORT_SYMBOL_FOR_KVM_INTERNAL(report_ignored_msrs);
-/* EFER defaults:
- * - enable syscall per default because its emulated by KVM
- * - enable LME and LMA per default on 64 bit KVM
- */
-#ifdef CONFIG_X86_64
-static
-u64 __read_mostly efer_reserved_bits = ~((u64)(EFER_SCE | EFER_LME | EFER_LMA));
-#else
-static u64 __read_mostly efer_reserved_bits = ~((u64)EFER_SCE);
-#endif
-
#define MAX_IO_MSRS 256
struct msr_bitmap_range {
@@ -614,7 +603,7 @@ static bool __kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer)
}
bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer)
{
- if (efer & efer_reserved_bits)
+ if (!(efer & kvm_caps.supported_efer_bits))
return false;
return __kvm_valid_efer(vcpu, efer);
@@ -627,7 +616,7 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
u64 efer = msr_info->data;
int r;
- if (efer & efer_reserved_bits)
+ if (!(efer & kvm_caps.supported_efer_bits))
return 1;
if (!msr_info->host_initiated) {
@@ -658,12 +647,6 @@ static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
return 0;
}
-void kvm_enable_efer_bits(u64 mask)
-{
- efer_reserved_bits &= ~mask;
-}
-EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_enable_efer_bits);
-
bool kvm_msr_allowed(struct kvm_vcpu *vcpu, u32 index, u32 type)
{
struct kvm_x86_msr_filter *msr_filter;
diff --git a/arch/x86/kvm/msrs.h b/arch/x86/kvm/msrs.h
index b698983e37fb61..89f10447cdddf9 100644
--- a/arch/x86/kvm/msrs.h
+++ b/arch/x86/kvm/msrs.h
@@ -59,6 +59,7 @@ int kvm_get_reg_list(struct kvm_vcpu *vcpu,
struct kvm_reg_list __user *user_list);
void kvm_enable_efer_bits(u64);
+void kvm_disable_efer_bits(u64);
bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer);
int kvm_emulate_msr_read(struct kvm_vcpu *vcpu, u32 index, u64 *data);
int kvm_emulate_msr_write(struct kvm_vcpu *vcpu, u32 index, u64 data);
diff --git a/arch/x86/kvm/regs.c b/arch/x86/kvm/regs.c
index d2caf5a67dba40..94c4e4e41868fc 100644
--- a/arch/x86/kvm/regs.c
+++ b/arch/x86/kvm/regs.c
@@ -563,7 +563,8 @@ static bool kvm_is_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
}
return kvm_is_valid_cr4(vcpu, sregs->cr4) &&
- kvm_is_valid_cr0(vcpu, sregs->cr0);
+ kvm_is_valid_cr0(vcpu, sregs->cr0) &&
+ kvm_valid_efer(vcpu, sregs->efer);
}
static int __set_sregs_common(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs,
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index ef69a51ab27f98..e755f43f4376ee 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -274,6 +274,15 @@ int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)
return 0;
}
+static void svm_setup_efer_caps(void)
+{
+ if (nested) {
+ kvm_caps.supported_efer_bits |= EFER_SVME;
+ if (!boot_cpu_has(X86_FEATURE_EFER_LMSLE_MBZ))
+ kvm_caps.supported_efer_bits |= EFER_LMSLE;
+ }
+}
+
static u32 svm_get_interrupt_shadow(struct kvm_vcpu *vcpu)
{
struct vcpu_svm *svm = to_svm(vcpu);
@@ -5364,6 +5373,7 @@ struct kvm_x86_ops svm_x86_ops __initdata = {
.is_valid_cr4 = svm_is_valid_cr4,
.set_cr4 = svm_set_cr4,
.set_efer = svm_set_efer,
+ .setup_efer_caps = svm_setup_efer_caps,
.get_idt = svm_get_idt,
.set_idt = svm_set_idt,
.get_gdt = svm_get_gdt,
@@ -5638,10 +5648,6 @@ static __init int svm_hardware_setup(void)
if (nested) {
pr_info("Nested Virtualization enabled\n");
- kvm_enable_efer_bits(EFER_SVME);
- if (!boot_cpu_has(X86_FEATURE_EFER_LMSLE_MBZ))
- kvm_enable_efer_bits(EFER_LMSLE);
-
r = nested_svm_init_msrpm_merge_offsets();
if (r)
return r;
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8dbc0fa302a8b5..5cedaa8409f8df 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6892,14 +6892,22 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_setup_xss_caps);
static void kvm_setup_efer_caps(void)
{
+ /* Enable syscall by default because its emulated by KVM */
+ kvm_caps.supported_efer_bits = (u64)EFER_SCE;
+
+ if (kvm_cpu_cap_has(X86_FEATURE_LM))
+ kvm_caps.supported_efer_bits |= (EFER_LME | EFER_LMA);
+
if (kvm_cpu_cap_has(X86_FEATURE_NX))
- kvm_enable_efer_bits(EFER_NX);
+ kvm_caps.supported_efer_bits |= EFER_NX;
if (kvm_cpu_cap_has(X86_FEATURE_FXSR_OPT))
- kvm_enable_efer_bits(EFER_FFXSR);
+ kvm_caps.supported_efer_bits |= EFER_FFXSR;
if (kvm_cpu_cap_has(X86_FEATURE_AUTOIBRS))
- kvm_enable_efer_bits(EFER_AUTOIBRS);
+ kvm_caps.supported_efer_bits |= EFER_AUTOIBRS;
+
+ kvm_x86_call(setup_efer_caps)();
}
static inline void kvm_ops_update(struct kvm_x86_init_ops *ops)
@@ -7038,13 +7046,13 @@ int kvm_x86_vendor_init(struct kvm_x86_init_ops *ops)
if (r != 0)
goto out_mmu_exit;
- kvm_setup_efer_caps();
-
enable_device_posted_irqs &= enable_apicv &&
irq_remapping_cap(IRQ_POSTING_CAP);
kvm_ops_update(ops);
+ kvm_setup_efer_caps();
+
for_each_online_cpu(cpu) {
smp_call_function_single(cpu, kvm_x86_check_cpu_compat, &r, 1);
if (r < 0)
diff --git a/tools/testing/selftests/kvm/include/x86/processor.h b/tools/testing/selftests/kvm/include/x86/processor.h
index 7d3a27bc0d842a..b161174ece4531 100644
--- a/tools/testing/selftests/kvm/include/x86/processor.h
+++ b/tools/testing/selftests/kvm/include/x86/processor.h
@@ -208,6 +208,7 @@ struct kvm_x86_cpu_feature {
#define X86_FEATURE_PERFCTR_NB KVM_X86_CPU_FEATURE(0x80000001, 0, ECX, 24)
#define X86_FEATURE_PERFCTR_LLC KVM_X86_CPU_FEATURE(0x80000001, 0, ECX, 28)
#define X86_FEATURE_NX KVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 20)
+#define X86_FEATURE_FXSR_OPT KVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 25)
#define X86_FEATURE_GBPAGES KVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 26)
#define X86_FEATURE_RDTSCP KVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 27)
#define X86_FEATURE_LM KVM_X86_CPU_FEATURE(0x80000001, 0, EDX, 29)
@@ -226,6 +227,7 @@ struct kvm_x86_cpu_feature {
#define X86_FEATURE_SEV KVM_X86_CPU_FEATURE(0x8000001F, 0, EAX, 1)
#define X86_FEATURE_SEV_ES KVM_X86_CPU_FEATURE(0x8000001F, 0, EAX, 3)
#define X86_FEATURE_SEV_SNP KVM_X86_CPU_FEATURE(0x8000001F, 0, EAX, 4)
+#define X86_FEATURE_AUTOIBRS KVM_X86_CPU_FEATURE(0x80000021, 0, EAX, 8)
#define X86_FEATURE_GP_ON_USER_CPUID KVM_X86_CPU_FEATURE(0x80000021, 0, EAX, 17)
#define X86_FEATURE_PERFMON_V2 KVM_X86_CPU_FEATURE(0x80000022, 0, EAX, 0)
#define X86_FEATURE_LBR_PMC_FREEZE KVM_X86_CPU_FEATURE(0x80000022, 0, EAX, 2)
diff --git a/tools/testing/selftests/kvm/x86/set_sregs_test.c b/tools/testing/selftests/kvm/x86/set_sregs_test.c
index 8e654cc9ab1687..562afab378d11e 100644
--- a/tools/testing/selftests/kvm/x86/set_sregs_test.c
+++ b/tools/testing/selftests/kvm/x86/set_sregs_test.c
@@ -21,20 +21,20 @@
#include "kvm_util.h"
#include "processor.h"
-#define TEST_INVALID_CR_BIT(vcpu, cr, orig, bit) \
+#define TEST_INVALID_SREG_BIT(vcpu, reg, orig, bit) \
do { \
struct kvm_sregs new; \
int rc; \
\
/* Skip the sub-test, the feature/bit is supported. */ \
- if (orig.cr & bit) \
+ if (orig.reg & bit) \
break; \
\
- memcpy(&new, &orig, sizeof(sregs)); \
- new.cr |= bit; \
+ memcpy(&new, &orig, sizeof(new)); \
+ new.reg |= bit; \
\
rc = _vcpu_sregs_set(vcpu, &new); \
- TEST_ASSERT(rc, "KVM allowed invalid " #cr " bit (0x%lx)", bit); \
+ TEST_ASSERT(rc, "KVM allowed invalid " #reg " bit (0x%llx)", (unsigned long long)bit); \
\
/* Sanity check that KVM didn't change anything. */ \
vcpu_sregs_get(vcpu, &new); \
@@ -46,6 +46,8 @@ do { \
X86_CR4_MCE | X86_CR4_PGE | X86_CR4_PCE | \
X86_CR4_OSFXSR | X86_CR4_OSXMMEXCPT)
+#define KVM_ALWAYS_ALLOWED_EFER EFER_SCE
+
static u64 calc_supported_cr4_feature_bits(void)
{
u64 cr4 = KVM_ALWAYS_ALLOWED_CR4;
@@ -74,6 +76,24 @@ static u64 calc_supported_cr4_feature_bits(void)
return cr4;
}
+static u64 calc_supported_efer_feature_bits(void)
+{
+ u64 efer = KVM_ALWAYS_ALLOWED_EFER;
+
+ if (kvm_cpu_has(X86_FEATURE_LM))
+ efer |= (EFER_LME | EFER_LMA);
+ if (kvm_cpu_has(X86_FEATURE_NX))
+ efer |= EFER_NX;
+ if (kvm_cpu_has(X86_FEATURE_SVM))
+ efer |= EFER_SVME;
+ if (kvm_cpu_has(X86_FEATURE_FXSR_OPT))
+ efer |= EFER_FFXSR;
+ if (kvm_cpu_has(X86_FEATURE_AUTOIBRS))
+ efer |= EFER_AUTOIBRS;
+
+ return efer;
+}
+
static void test_cr_bits(struct kvm_vcpu *vcpu, u64 cr4)
{
struct kvm_sregs sregs;
@@ -96,26 +116,45 @@ static void test_cr_bits(struct kvm_vcpu *vcpu, u64 cr4)
(sregs.cr4 & X86_CR4_PKE) ? "set" : "clear");
vcpu_sregs_get(vcpu, &sregs);
- TEST_ASSERT(sregs.cr4 == cr4, "sregs.CR4 (0x%llx) != CR4 (0x%lx)",
- sregs.cr4, cr4);
-
- TEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_UMIP);
- TEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_LA57);
- TEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_VMXE);
- TEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_SMXE);
- TEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_FSGSBASE);
- TEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_PCIDE);
- TEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_OSXSAVE);
- TEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_SMEP);
- TEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_SMAP);
- TEST_INVALID_CR_BIT(vcpu, cr4, sregs, X86_CR4_PKE);
+ TEST_ASSERT_EQ(sregs.cr4, cr4);
+
+ TEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_UMIP);
+ TEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_LA57);
+ TEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_VMXE);
+ TEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_SMXE);
+ TEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_FSGSBASE);
+ TEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_PCIDE);
+ TEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_OSXSAVE);
+ TEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_SMEP);
+ TEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_SMAP);
+ TEST_INVALID_SREG_BIT(vcpu, cr4, sregs, X86_CR4_PKE);
for (i = 32; i < 64; i++)
- TEST_INVALID_CR_BIT(vcpu, cr0, sregs, BIT(i));
+ TEST_INVALID_SREG_BIT(vcpu, cr0, sregs, BIT(i));
/* NW without CD is illegal, as is PG without PE. */
- TEST_INVALID_CR_BIT(vcpu, cr0, sregs, X86_CR0_NW);
- TEST_INVALID_CR_BIT(vcpu, cr0, sregs, X86_CR0_PG);
+ TEST_INVALID_SREG_BIT(vcpu, cr0, sregs, X86_CR0_NW);
+ TEST_INVALID_SREG_BIT(vcpu, cr0, sregs, X86_CR0_PG);
+}
+
+static void test_efer_bits(struct kvm_vcpu *vcpu, u64 efer)
+{
+ struct kvm_sregs sregs;
+ int rc;
+
+ vcpu_sregs_get(vcpu, &sregs);
+ sregs.efer |= efer;
+ rc = _vcpu_sregs_set(vcpu, &sregs);
+ TEST_ASSERT(!rc, "Failed to set supported EFER bits (0x%llx)", sregs.efer);
+
+ vcpu_sregs_get(vcpu, &sregs);
+ TEST_ASSERT_EQ(sregs.efer, efer);
+
+ TEST_INVALID_SREG_BIT(vcpu, efer, sregs, EFER_LME);
+ TEST_INVALID_SREG_BIT(vcpu, efer, sregs, EFER_NX);
+ TEST_INVALID_SREG_BIT(vcpu, efer, sregs, EFER_SVME);
+ TEST_INVALID_SREG_BIT(vcpu, efer, sregs, EFER_FFXSR);
+ TEST_INVALID_SREG_BIT(vcpu, efer, sregs, EFER_AUTOIBRS);
}
int main(int argc, char *argv[])
@@ -132,6 +171,7 @@ int main(int argc, char *argv[])
*/
vm = vm_create_barebones();
vcpu = __vm_vcpu_add(vm, 0);
+ test_efer_bits(vcpu, KVM_ALWAYS_ALLOWED_EFER);
test_cr_bits(vcpu, KVM_ALWAYS_ALLOWED_CR4);
kvm_vm_free(vm);
@@ -151,6 +191,7 @@ int main(int argc, char *argv[])
sregs.apic_base);
test_cr_bits(vcpu, calc_supported_cr4_feature_bits());
+ test_efer_bits(vcpu, calc_supported_efer_feature_bits());
kvm_vm_free(vm);
|
| 3/2 | 2026/07/01 06:28 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 8252 output: 21 thoughts: 627 Thoughts: **Analyzing the KVM x86 EFER MSR Patch for Fuzzing** Okay, so I'm looking at this patch that's fundamentally changing how KVM x86 handles the EFER MSR and sregs. It's touching a few key areas, and my expert intuition is screaming "fuzzing opportunity." We've got a new `setup_efer_caps` function in `kvm_x86_ops`, leveraging `kvm_caps.supported_efer_bits` instead of `efer_reserved_bits` – that's a signal. The changes are impacting `kvm_valid_efer` and `set_efer` in `arch/x86/kvm/msrs.c`, and also `kvm_is_valid_sregs` in `arch/x86/kvm/regs.c` to include a check for `kvm_valid_efer`. Furthermore, we have additions of `svm_setup_efer_caps` in `arch/x86/kvm/svm/svm.c`, and a modification in `kvm_setup_efer_caps` in `arch/x86/kvm/x86.c`. My initial thought is to zero in on these functions for fuzzing campaigns: `kvm_valid_efer`, `set_efer`, `kvm_is_valid_sregs`, `svm_setup_efer_caps`, and `kvm_setup_efer_caps`. I'm also considering `__set_sregs_common` as a potential area to investigate, just to be thorough. Now, let's confirm the call chains, and the function definitions in the relevant code files. I'm taking a look at `arch/x86/kvm/msrs.c` and found `set_efer` is a static function, and `kvm_valid_efer` is global. So, `set_efer` is an implementation detail inside of the `msrs.c` file and only callable from inside it. I also confirmed with `grepper` that `kvm_is_valid_sregs` is static in `arch/x86/kvm/regs.c`, and `svm_setup_efer_caps` is static in `arch/x86/kvm/svm/svm.c`, and that `kvm_setup_efer_caps` is static in `arch/x86/kvm/x86.c`. Using `grepper`, I'm confirming the call relationships. `kvm_valid_efer` is definitely called from `kvm_is_valid_sregs` and `set_efer`. And from inspection, `set_efer` itself is called by `kvm_set_msr_common` when dealing with `MSR_EFER`. Finally, a quick Kconfig check tells me that CONFIG_KVM is a hard requirement, and we'll need either CONFIG_KVM_AMD or CONFIG_KVM_INTEL depending on the host CPU. Alright, let's now utilize `grepper` to find exactly where `kvm_valid_efer` is defined. This'll help me understand its exact scope and how it's being used within the larger KVM x86 context. This seems like a promising path to start. |
| 4/2 | 2026/07/01 06:28 | tool | grepper |
0mArgs:{
"Expression": "kvm_valid_efer"
}Results: {
"Output": "arch/x86/kvm/msrs.c=577=static int do_get_feature_msr(struct kvm_vcpu *vcpu, unsigned index, u64 *data)\n--\narch/x86/kvm/msrs.c-582-\narch/x86/kvm/msrs.c:583:static bool __kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer)\narch/x86/kvm/msrs.c-584-{\n--\narch/x86/kvm/msrs.c-603-}\narch/x86/kvm/msrs.c:604:bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer)\narch/x86/kvm/msrs.c-605-{\n--\narch/x86/kvm/msrs.c-608-\narch/x86/kvm/msrs.c:609:\treturn __kvm_valid_efer(vcpu, efer);\narch/x86/kvm/msrs.c-610-}\narch/x86/kvm/msrs.c:611:EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_valid_efer);\narch/x86/kvm/msrs.c-612-\narch/x86/kvm/msrs.c=613=static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info)\n--\narch/x86/kvm/msrs.c-622-\tif (!msr_info-\u003ehost_initiated) {\narch/x86/kvm/msrs.c:623:\t\tif (!__kvm_valid_efer(vcpu, efer))\narch/x86/kvm/msrs.c-624-\t\t\treturn 1;\n--\narch/x86/kvm/msrs.h=62=void kvm_disable_efer_bits(u64);\narch/x86/kvm/msrs.h:63:bool kvm_valid_efer(struct kvm_vcpu *vcpu, u64 efer);\narch/x86/kvm/msrs.h-64-int kvm_emulate_msr_read(struct kvm_vcpu *vcpu, u32 index, u64 *data);\n--\narch/x86/kvm/regs.c=544=static bool kvm_is_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)\n--\narch/x86/kvm/regs.c-566-\t kvm_is_valid_cr0(vcpu, sregs-\u003ecr0) \u0026\u0026\narch/x86/kvm/regs.c:567:\t kvm_valid_efer(vcpu, sregs-\u003eefer);\narch/x86/kvm/regs.c-568-}\n--\narch/x86/kvm/svm/nested.c=439=static bool nested_vmcb_check_save(struct kvm_vcpu *vcpu,\n--\narch/x86/kvm/svm/nested.c-472-\narch/x86/kvm/svm/nested.c:473:\tif (CC(!kvm_valid_efer(vcpu, save-\u003eefer)))\narch/x86/kvm/svm/nested.c-474-\t\treturn false;\n--\narch/x86/kvm/svm/svm.c=2746=static int efer_trap(struct kvm_vcpu *vcpu)\n--\narch/x86/kvm/svm/svm.c-2752-\t * Clear the EFER_SVME bit from EFER. The SVM code always sets this\narch/x86/kvm/svm/svm.c:2753:\t * bit in svm_set_efer(), but __kvm_valid_efer() checks it against\narch/x86/kvm/svm/svm.c-2754-\t * whether the guest has X86_FEATURE_SVM - this avoids a failure if\n--\narch/x86/kvm/vmx/nested.c=3172=static int nested_vmx_check_host_state(struct kvm_vcpu *vcpu,\n--\narch/x86/kvm/vmx/nested.c-3234-\tif (vmcs12-\u003evm_exit_controls \u0026 VM_EXIT_LOAD_IA32_EFER) {\narch/x86/kvm/vmx/nested.c:3235:\t\tif (CC(!kvm_valid_efer(vcpu, vmcs12-\u003ehost_ia32_efer)) ||\narch/x86/kvm/vmx/nested.c-3236-\t\t CC(ia32e != !!(vmcs12-\u003ehost_ia32_efer \u0026 EFER_LMA)) ||\n--\narch/x86/kvm/vmx/nested.c=3308=static int nested_vmx_check_guest_state(struct kvm_vcpu *vcpu,\n--\narch/x86/kvm/vmx/nested.c-3373-\t (vmcs12-\u003evm_entry_controls \u0026 VM_ENTRY_LOAD_IA32_EFER)) {\narch/x86/kvm/vmx/nested.c:3374:\t\tif (CC(!kvm_valid_efer(vcpu, vmcs12-\u003eguest_ia32_efer)) ||\narch/x86/kvm/vmx/nested.c-3375-\t\t CC(ia32e != !!(vmcs12-\u003eguest_ia32_efer \u0026 EFER_LMA)) ||\n"
} |
| 5/2 | 2026/07/01 06:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 11142 output: 18 thoughts: 269 Thoughts: **Analyzing the EFER MSR Modification Patch** Okay, so I'm looking at this patch and my initial thought is, it looks like it's touching MSR handling, specifically EFER. I see changes in `kvm_valid_efer` and `set_efer` within `arch/x86/kvm/msrs.c`. That's a key area to zero in on. The patch also adds these `_setup_efer_caps` functions, one in the SVM directory and the other in the x86 directory. But those look like initialization functions, which makes them less interesting for my purposes – fuzzing, mostly. Now, `set_efer`... that's a static function, but it *is* called through some other mechanism like `kvm_set_msr_common`, so that's something to consider. I need to understand the call flow. I'm thinking, `kvm_valid_efer` is definitely a good target for deeper analysis. That seems like a prime area for validating the MSR value before setting it. And, while I'm at it, I should also look at `kvm_is_valid_sregs`. Those checks are often goldmines for subtle bugs. I should also note that `set_efer` could be a key place to explore too. |
| 6/2 | 2026/07/01 06:29 | tool | grepper |
0mArgs:{
"Expression": "set_efer"
}Results: {
"Output": "arch/x86/include/asm/kvm-x86-ops.h=46=KVM_X86_OP(set_cr4)\narch/x86/include/asm/kvm-x86-ops.h:47:KVM_X86_OP(set_efer)\narch/x86/include/asm/kvm-x86-ops.h-48-KVM_X86_OP_OPTIONAL(setup_efer_caps)\n--\narch/x86/include/asm/kvm_host.h=1684=struct kvm_x86_ops {\n--\narch/x86/include/asm/kvm_host.h-1733-\tvoid (*set_cr4)(struct kvm_vcpu *vcpu, unsigned long cr4);\narch/x86/include/asm/kvm_host.h:1734:\tint (*set_efer)(struct kvm_vcpu *vcpu, u64 efer);\narch/x86/include/asm/kvm_host.h-1735-\tvoid (*setup_efer_caps)(void);\n--\narch/x86/kvm/msrs.c=611=EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_valid_efer);\narch/x86/kvm/msrs.c-612-\narch/x86/kvm/msrs.c:613:static int set_efer(struct kvm_vcpu *vcpu, struct msr_data *msr_info)\narch/x86/kvm/msrs.c-614-{\n--\narch/x86/kvm/msrs.c-633-\narch/x86/kvm/msrs.c:634:\tr = kvm_x86_call(set_efer)(vcpu, efer);\narch/x86/kvm/msrs.c-635-\tif (r) {\n--\narch/x86/kvm/msrs.c=1442=int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)\n--\narch/x86/kvm/msrs.c-1539-\tcase MSR_EFER:\narch/x86/kvm/msrs.c:1540:\t\treturn set_efer(vcpu, msr_info);\narch/x86/kvm/msrs.c-1541-\tcase MSR_K7_HWCR: {\n--\narch/x86/kvm/regs.c=570=static int __set_sregs_common(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs,\n--\narch/x86/kvm/regs.c-598-\t*mmu_reset_needed |= vcpu-\u003earch.efer != sregs-\u003eefer;\narch/x86/kvm/regs.c:599:\tkvm_x86_call(set_efer)(vcpu, sregs-\u003eefer);\narch/x86/kvm/regs.c-600-\n--\narch/x86/kvm/smm.c=279=void enter_smm(struct kvm_vcpu *vcpu)\n--\narch/x86/kvm/smm.c-361-\tif (guest_cpu_cap_has(vcpu, X86_FEATURE_LM))\narch/x86/kvm/smm.c:362:\t\tif (kvm_x86_call(set_efer)(vcpu, 0))\narch/x86/kvm/smm.c-363-\t\t\tgoto error;\n--\narch/x86/kvm/svm/nested.c=745=static void nested_vmcb02_prepare_save(struct vcpu_svm *svm)\n--\narch/x86/kvm/svm/nested.c-792-\narch/x86/kvm/svm/nested.c:793:\tsvm_set_efer(vcpu, svm-\u003enested.save.efer);\narch/x86/kvm/svm/nested.c-794-\n--\narch/x86/kvm/svm/nested.c=1322=void nested_svm_vmexit(struct vcpu_svm *svm)\n--\narch/x86/kvm/svm/nested.c-1427-\tkvm_set_rflags(vcpu, vmcb01-\u003esave.rflags);\narch/x86/kvm/svm/nested.c:1428:\tsvm_set_efer(vcpu, vmcb01-\u003esave.efer);\narch/x86/kvm/svm/nested.c-1429-\tsvm_set_cr0(vcpu, vmcb01-\u003esave.cr0 | X86_CR0_PE);\n--\narch/x86/kvm/svm/svm.c=201=static int get_npt_level(void)\n--\narch/x86/kvm/svm/svm.c-209-\narch/x86/kvm/svm/svm.c:210:int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)\narch/x86/kvm/svm/svm.c-211-{\n--\narch/x86/kvm/svm/svm.c=2746=static int efer_trap(struct kvm_vcpu *vcpu)\n--\narch/x86/kvm/svm/svm.c-2752-\t * Clear the EFER_SVME bit from EFER. The SVM code always sets this\narch/x86/kvm/svm/svm.c:2753:\t * bit in svm_set_efer(), but __kvm_valid_efer() checks it against\narch/x86/kvm/svm/svm.c-2754-\t * whether the guest has X86_FEATURE_SVM - this avoids a failure if\n--\narch/x86/kvm/svm/svm.c=5334=struct kvm_x86_ops svm_x86_ops __initdata = {\n--\narch/x86/kvm/svm/svm.c-5374-\t.set_cr4 = svm_set_cr4,\narch/x86/kvm/svm/svm.c:5375:\t.set_efer = svm_set_efer,\narch/x86/kvm/svm/svm.c-5376-\t.setup_efer_caps = svm_setup_efer_caps,\n--\narch/x86/kvm/svm/svm.h=809=void svm_update_lbrv(struct kvm_vcpu *vcpu);\narch/x86/kvm/svm/svm.h-810-\narch/x86/kvm/svm/svm.h:811:int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer);\narch/x86/kvm/svm/svm.h-812-void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0);\n--\narch/x86/kvm/vmx/main.c=413=static void vt_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)\n--\narch/x86/kvm/vmx/main.c-420-\narch/x86/kvm/vmx/main.c:421:static int vt_set_efer(struct kvm_vcpu *vcpu, u64 efer)\narch/x86/kvm/vmx/main.c-422-{\n--\narch/x86/kvm/vmx/main.c-425-\narch/x86/kvm/vmx/main.c:426:\treturn vmx_set_efer(vcpu, efer);\narch/x86/kvm/vmx/main.c-427-}\n--\narch/x86/kvm/vmx/main.c=880=struct kvm_x86_ops vt_x86_ops __initdata = {\n--\narch/x86/kvm/vmx/main.c-924-\t.set_cr4 = vt_op(set_cr4),\narch/x86/kvm/vmx/main.c:925:\t.set_efer = vt_op(set_efer),\narch/x86/kvm/vmx/main.c-926-\t.get_idt = vt_op(get_idt),\n--\narch/x86/kvm/vmx/nested.c=2396=static void prepare_vmcs02_early(struct vcpu_vmx *vmx, struct loaded_vmcs *vmcs01,\n--\narch/x86/kvm/vmx/nested.c-2509-\t * vmcs12's VM_{ENTRY,EXIT}_LOAD_IA32_EFER and VM_ENTRY_IA32E_MODE\narch/x86/kvm/vmx/nested.c:2510:\t * are emulated by vmx_set_efer() in prepare_vmcs02(), but speculate\narch/x86/kvm/vmx/nested.c-2511-\t * on the related bits (if supported by the CPU) in the hope that\narch/x86/kvm/vmx/nested.c:2512:\t * we can avoid VMWrites during vmx_set_efer().\narch/x86/kvm/vmx/nested.c-2513-\t *\n--\narch/x86/kvm/vmx/nested.c-2534-\t * we should use its exit controls. Note that VM_EXIT_LOAD_IA32_EFER\narch/x86/kvm/vmx/nested.c:2535:\t * bits may be modified by vmx_set_efer() in prepare_vmcs02().\narch/x86/kvm/vmx/nested.c-2536-\t */\n--\narch/x86/kvm/vmx/nested.c=2725=static int prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12,\n--\narch/x86/kvm/vmx/nested.c-2808-\t/* Note: may modify VM_ENTRY/EXIT_CONTROLS and GUEST/HOST_IA32_EFER */\narch/x86/kvm/vmx/nested.c:2809:\tvmx_set_efer(vcpu, vcpu-\u003earch.efer);\narch/x86/kvm/vmx/nested.c-2810-\n--\narch/x86/kvm/vmx/nested.c=4795=static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,\n--\narch/x86/kvm/vmx/nested.c-4806-\t\tvcpu-\u003earch.efer \u0026= ~(EFER_LMA | EFER_LME);\narch/x86/kvm/vmx/nested.c:4807:\tvmx_set_efer(vcpu, vcpu-\u003earch.efer);\narch/x86/kvm/vmx/nested.c-4808-\n--\narch/x86/kvm/vmx/nested.c=4955=static void nested_vmx_restore_host_state(struct kvm_vcpu *vcpu)\n--\narch/x86/kvm/vmx/nested.c-4984-\t */\narch/x86/kvm/vmx/nested.c:4985:\tvmx_set_efer(vcpu, nested_vmx_get_vmcs01_guest_efer(vmx));\narch/x86/kvm/vmx/nested.c-4986-\n--\narch/x86/kvm/vmx/vmx.c=3201=static void enter_rmode(struct kvm_vcpu *vcpu)\n--\narch/x86/kvm/vmx/vmx.c-3248-\narch/x86/kvm/vmx/vmx.c:3249:int vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer)\narch/x86/kvm/vmx/vmx.c-3250-{\n--\narch/x86/kvm/vmx/vmx.c=3274=static void enter_lmode(struct kvm_vcpu *vcpu)\n--\narch/x86/kvm/vmx/vmx.c-3287-\t}\narch/x86/kvm/vmx/vmx.c:3288:\tvmx_set_efer(vcpu, vcpu-\u003earch.efer | EFER_LMA);\narch/x86/kvm/vmx/vmx.c-3289-}\n--\narch/x86/kvm/vmx/vmx.c=3291=static void exit_lmode(struct kvm_vcpu *vcpu)\narch/x86/kvm/vmx/vmx.c-3292-{\narch/x86/kvm/vmx/vmx.c:3293:\tvmx_set_efer(vcpu, vcpu-\u003earch.efer \u0026 ~EFER_LMA);\narch/x86/kvm/vmx/vmx.c-3294-}\n--\narch/x86/kvm/vmx/vmx.h=350=void vmx_set_interrupt_shadow(struct kvm_vcpu *vcpu, int mask);\narch/x86/kvm/vmx/vmx.h:351:int vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer);\narch/x86/kvm/vmx/vmx.h-352-void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0);\n--\narch/x86/kvm/vmx/x86_ops.h=71=bool vmx_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4);\narch/x86/kvm/vmx/x86_ops.h:72:int vmx_set_efer(struct kvm_vcpu *vcpu, u64 efer);\narch/x86/kvm/vmx/x86_ops.h-73-void vmx_get_idt(struct kvm_vcpu *vcpu, struct desc_ptr *dt);\n--\narch/x86/kvm/x86.c=9479=void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)\n--\narch/x86/kvm/x86.c-9585-\tkvm_x86_call(set_cr4)(vcpu, 0);\narch/x86/kvm/x86.c:9586:\tkvm_x86_call(set_efer)(vcpu, 0);\narch/x86/kvm/x86.c-9587-\tkvm_x86_call(update_exception_bitmap)(vcpu);\n"
} |
| 7/2 | 2026/07/01 06:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 15680 output: 17 thoughts: 523 Thoughts: **Analyzing Potential Fuzzing Targets in KVM/x86 MSR Handling** Okay, so I'm digging into this patch. My initial thought was to look at `set_efer` in `arch/x86/kvm/msrs.c` because the patch modifies it. Wait, `set_efer` is *static* within `msrs.c`. Hmm, that changes things a bit. I know `kvm_set_msr_common` calls `set_efer`, but that's a heavily used hot path, a bit too broad for focused fuzzing. My next thought: even though `set_efer` is static, Syzkaller *can* fuzz static functions *if* they're in the coverage, or, more relevantly, if they're in the symbol table. We also use `FocusSymbols` to guide the fuzzer, so I need to decide if this is a good symbol to focus on. Looks like a good symbol, so I'll go with `set_efer`. Then I remember `kvm_valid_efer` is exported and global. Perfect. I also see that `kvm_is_valid_sregs` is static within `regs.c` and `__set_sregs_common` is static in `regs.c`, so I'll add those. So the initial focus will be on `kvm_valid_efer`, `set_efer`, `kvm_is_valid_sregs`, and `__set_sregs_common`. Just to be sure, I'll quickly check `arch/x86/kvm/svm/svm.c` and `arch/x86/kvm/x86.c` for any related functions, like `svm_setup_efer_caps` and `kvm_setup_efer_caps`. Ah, both are init functions, called only during setup – not relevant for *runtime* fuzzing. Therefore, the main functional changes reachable during VM execution are: `kvm_valid_efer`, `set_efer` (in msrs.c), and `kvm_is_valid_sregs`. We'll ignore `__set_sregs_common` for now. Let's do a quick search to make sure I'm not missing any other functions that are touched. Right, the patch *also* touches `tools/testing/selftests/kvm/x86/set_sregs_test.c`, but that's just a test, not code that executes during the VM's normal operation. Finally, I need to check the Kconfig files. I'll search for `KVM`, `KVM_AMD`, and `KVM_INTEL` to see if there are any specific configurations that might be relevant to EFER or similar settings. That might give me a broader picture of where these settings are being used and any dependencies. |
| 8/2 | 2026/07/01 06:29 | tool | grepper |
0mArgs:{
"Expression": "config KVM"
}Results: {
"Output": "arch/arm64/kvm/Kconfig=18=if VIRTUALIZATION\narch/arm64/kvm/Kconfig-19-\narch/arm64/kvm/Kconfig:20:menuconfig KVM\narch/arm64/kvm/Kconfig-21-\tbool \"Kernel-based Virtual Machine (KVM) support\"\n--\narch/loongarch/kvm/Kconfig=18=if VIRTUALIZATION\narch/loongarch/kvm/Kconfig-19-\narch/loongarch/kvm/Kconfig:20:config KVM\narch/loongarch/kvm/Kconfig-21-\ttristate \"Kernel-based Virtual Machine (KVM) support\"\n--\narch/mips/kvm/Kconfig=16=if VIRTUALIZATION\narch/mips/kvm/Kconfig-17-\narch/mips/kvm/Kconfig:18:config KVM\narch/mips/kvm/Kconfig-19-\ttristate \"Kernel-based Virtual Machine (KVM) support\"\n--\narch/mips/kvm/Kconfig-30-\narch/mips/kvm/Kconfig:31:config KVM_MIPS_DEBUG_COP0_COUNTERS\narch/mips/kvm/Kconfig-32-\tbool \"Maintain counters for COP0 accesses\"\n--\narch/powerpc/kvm/Kconfig=18=if VIRTUALIZATION\narch/powerpc/kvm/Kconfig-19-\narch/powerpc/kvm/Kconfig:20:config KVM\narch/powerpc/kvm/Kconfig-21-\tbool\n--\narch/powerpc/kvm/Kconfig-25-\narch/powerpc/kvm/Kconfig:26:config KVM_BOOK3S_HANDLER\narch/powerpc/kvm/Kconfig-27-\tbool\narch/powerpc/kvm/Kconfig-28-\narch/powerpc/kvm/Kconfig:29:config KVM_BOOK3S_32_HANDLER\narch/powerpc/kvm/Kconfig-30-\tbool\n--\narch/powerpc/kvm/Kconfig-33-\narch/powerpc/kvm/Kconfig:34:config KVM_BOOK3S_64_HANDLER\narch/powerpc/kvm/Kconfig-35-\tbool\n--\narch/powerpc/kvm/Kconfig-37-\narch/powerpc/kvm/Kconfig:38:config KVM_BOOK3S_PR_POSSIBLE\narch/powerpc/kvm/Kconfig-39-\tbool\n--\narch/powerpc/kvm/Kconfig-41-\narch/powerpc/kvm/Kconfig:42:config KVM_BOOK3S_HV_POSSIBLE\narch/powerpc/kvm/Kconfig-43-\tbool\narch/powerpc/kvm/Kconfig-44-\narch/powerpc/kvm/Kconfig:45:config KVM_BOOK3S_32\narch/powerpc/kvm/Kconfig-46-\ttristate \"KVM support for PowerPC book3s_32 processors\"\n--\narch/powerpc/kvm/Kconfig-61-\narch/powerpc/kvm/Kconfig:62:config KVM_BOOK3S_64\narch/powerpc/kvm/Kconfig-63-\ttristate \"KVM support for PowerPC book3s_64 processors\"\n--\narch/powerpc/kvm/Kconfig-78-\narch/powerpc/kvm/Kconfig:79:config KVM_BOOK3S_64_HV\narch/powerpc/kvm/Kconfig-80-\ttristate \"KVM for POWER7 and later using hypervisor mode in host\"\n--\narch/powerpc/kvm/Kconfig-99-\narch/powerpc/kvm/Kconfig:100:config KVM_BOOK3S_64_PR\narch/powerpc/kvm/Kconfig-101-\ttristate \"KVM support without using hypervisor mode in host\"\n--\narch/powerpc/kvm/Kconfig-125-\narch/powerpc/kvm/Kconfig:126:config KVM_BOOK3S_HV_EXIT_TIMING\narch/powerpc/kvm/Kconfig-127-\tbool\narch/powerpc/kvm/Kconfig-128-\narch/powerpc/kvm/Kconfig:129:config KVM_BOOK3S_HV_P9_TIMING\narch/powerpc/kvm/Kconfig-130-\tbool \"Detailed timing for the P9 entry point\"\n--\narch/powerpc/kvm/Kconfig-141-\narch/powerpc/kvm/Kconfig:142:config KVM_BOOK3S_HV_P8_TIMING\narch/powerpc/kvm/Kconfig-143-\tbool \"Detailed timing for hypervisor real-mode code (for POWER8)\"\n--\narch/powerpc/kvm/Kconfig-156-\narch/powerpc/kvm/Kconfig:157:config KVM_BOOK3S_HV_NESTED_PMU_WORKAROUND\narch/powerpc/kvm/Kconfig-158-\tbool \"Nested L0 host workaround for L1 KVM host PMU handling bug\" if EXPERT\n--\narch/powerpc/kvm/Kconfig-171-\narch/powerpc/kvm/Kconfig:172:config KVM_BOOK3S_HV_PMU\narch/powerpc/kvm/Kconfig-173-\ttristate \"Hypervisor Perf events for KVM Book3s-HV\"\n--\narch/powerpc/kvm/Kconfig-183-\narch/powerpc/kvm/Kconfig:184:config KVM_BOOKE_HV\narch/powerpc/kvm/Kconfig-185-\tbool\narch/powerpc/kvm/Kconfig-186-\narch/powerpc/kvm/Kconfig:187:config KVM_EXIT_TIMING\narch/powerpc/kvm/Kconfig-188-\tbool \"Detailed exit timing\"\n--\narch/powerpc/kvm/Kconfig-197-\narch/powerpc/kvm/Kconfig:198:config KVM_E500V2\narch/powerpc/kvm/Kconfig-199-\tbool \"KVM support for PowerPC E500v2 processors\"\n--\narch/powerpc/kvm/Kconfig-212-\narch/powerpc/kvm/Kconfig:213:config KVM_E500MC\narch/powerpc/kvm/Kconfig-214-\tbool \"KVM support for PowerPC E500MC/E5500/E6500 processors\"\n--\narch/powerpc/kvm/Kconfig-228-\narch/powerpc/kvm/Kconfig:229:config KVM_MPIC\narch/powerpc/kvm/Kconfig-230-\tbool \"KVM in-kernel MPIC emulation\"\n--\narch/powerpc/kvm/Kconfig-240-\narch/powerpc/kvm/Kconfig:241:config KVM_XICS\narch/powerpc/kvm/Kconfig-242-\tbool \"KVM in-kernel XICS emulation\"\n--\narch/powerpc/kvm/Kconfig-250-\narch/powerpc/kvm/Kconfig:251:config KVM_XIVE\narch/powerpc/kvm/Kconfig-252-\tbool\n--\narch/powerpc/platforms/Kconfig=22=source \"arch/powerpc/platforms/microwatt/Kconfig\"\narch/powerpc/platforms/Kconfig-23-\narch/powerpc/platforms/Kconfig:24:config KVM_GUEST\narch/powerpc/platforms/Kconfig-25-\tbool \"KVM Guest support\"\n--\narch/riscv/kvm/Kconfig=18=if VIRTUALIZATION\narch/riscv/kvm/Kconfig-19-\narch/riscv/kvm/Kconfig:20:config KVM\narch/riscv/kvm/Kconfig-21-\ttristate \"Kernel-based Virtual Machine (KVM) support\"\n--\narch/s390/kvm/Kconfig=17=if VIRTUALIZATION\narch/s390/kvm/Kconfig-18-\narch/s390/kvm/Kconfig:19:config KVM\narch/s390/kvm/Kconfig-20-\tdef_tristate y\n--\narch/s390/kvm/Kconfig-46-\narch/s390/kvm/Kconfig:47:config KVM_S390_UCONTROL\narch/s390/kvm/Kconfig-48-\tbool \"Userspace controlled virtual machines\"\n--\narch/x86/Kconfig=839=source \"arch/x86/xen/Kconfig\"\narch/x86/Kconfig-840-\narch/x86/Kconfig:841:config KVM_GUEST\narch/x86/Kconfig-842-\tbool \"KVM Guest support (including kvmclock)\"\n--\narch/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-51-\narch/x86/kvm/Kconfig:52:config KVM\narch/x86/kvm/Kconfig-53-\ttristate \"Kernel-based Virtual Machine (KVM) support\"\n--\narch/x86/kvm/Kconfig-68-\narch/x86/kvm/Kconfig:69:config KVM_WERROR\narch/x86/kvm/Kconfig-70-\tbool \"Compile KVM with -Werror\"\n--\narch/x86/kvm/Kconfig-82-\narch/x86/kvm/Kconfig:83:config KVM_SW_PROTECTED_VM\narch/x86/kvm/Kconfig-84-\tbool \"Enable support for KVM software-protected VMs\"\n--\narch/x86/kvm/Kconfig-95-\narch/x86/kvm/Kconfig:96:config KVM_INTEL\narch/x86/kvm/Kconfig-97-\ttristate \"KVM for Intel (and compatible) processors support\"\n--\narch/x86/kvm/Kconfig-106-\narch/x86/kvm/Kconfig:107:config KVM_INTEL_PROVE_VE\narch/x86/kvm/Kconfig-108- bool \"Check that guests do not receive #VE exceptions\"\n--\narch/x86/kvm/Kconfig=122=config X86_SGX_KVM\n--\narch/x86/kvm/Kconfig-133-\narch/x86/kvm/Kconfig:134:config KVM_INTEL_TDX\narch/x86/kvm/Kconfig-135-\tbool \"Intel Trust Domain Extensions (TDX) support\"\n--\narch/x86/kvm/Kconfig-145-\narch/x86/kvm/Kconfig:146:config KVM_AMD\narch/x86/kvm/Kconfig-147-\ttristate \"KVM for AMD processors support\"\n--\narch/x86/kvm/Kconfig-155-\narch/x86/kvm/Kconfig:156:config KVM_AMD_SEV\narch/x86/kvm/Kconfig-157-\tbool \"AMD Secure Encrypted Virtualization (SEV) support\"\n--\narch/x86/kvm/Kconfig-171-\narch/x86/kvm/Kconfig:172:config KVM_IOAPIC\narch/x86/kvm/Kconfig-173-\tbool \"I/O APIC, PIC, and PIT emulation\"\n--\narch/x86/kvm/Kconfig-181-\narch/x86/kvm/Kconfig:182:config KVM_SMM\narch/x86/kvm/Kconfig-183-\tbool \"System Management Mode emulation\"\n--\narch/x86/kvm/Kconfig-192-\narch/x86/kvm/Kconfig:193:config KVM_HYPERV\narch/x86/kvm/Kconfig-194-\tbool \"Support for Microsoft Hyper-V emulation\"\n--\narch/x86/kvm/Kconfig-206-\narch/x86/kvm/Kconfig:207:config KVM_XEN\narch/x86/kvm/Kconfig-208-\tbool \"Support for Xen hypercall interface\"\n--\narch/x86/kvm/Kconfig-215-\narch/x86/kvm/Kconfig:216:config KVM_PROVE_MMU\narch/x86/kvm/Kconfig-217-\tbool \"Prove KVM MMU correctness\"\n--\narch/x86/kvm/Kconfig-228-\narch/x86/kvm/Kconfig:229:config KVM_EXTERNAL_WRITE_TRACKING\narch/x86/kvm/Kconfig-230-\tbool\narch/x86/kvm/Kconfig-231-\narch/x86/kvm/Kconfig:232:config KVM_MAX_NR_VCPUS\narch/x86/kvm/Kconfig-233-\tint \"Maximum number of vCPUs per KVM guest\"\n--\nvirt/kvm/Kconfig-3-\nvirt/kvm/Kconfig:4:config KVM_COMMON\nvirt/kvm/Kconfig-5- bool\n--\nvirt/kvm/Kconfig=39=config NEED_KVM_DIRTY_RING_WITH_BITMAP\n--\nvirt/kvm/Kconfig-42-\nvirt/kvm/Kconfig:43:config KVM_MMIO\nvirt/kvm/Kconfig-44- bool\nvirt/kvm/Kconfig-45-\nvirt/kvm/Kconfig:46:config KVM_ASYNC_PF\nvirt/kvm/Kconfig-47- bool\n--\nvirt/kvm/Kconfig-49-# Toggle to switch between direct notification and batch job\nvirt/kvm/Kconfig:50:config KVM_ASYNC_PF_SYNC\nvirt/kvm/Kconfig-51- bool\n--\nvirt/kvm/Kconfig=59=config HAVE_KVM_CPU_RELAX_INTERCEPT\n--\nvirt/kvm/Kconfig-61-\nvirt/kvm/Kconfig:62:config KVM_VFIO\nvirt/kvm/Kconfig-63- bool\n--\nvirt/kvm/Kconfig=65=config HAVE_KVM_INVALID_WAKEUPS\n--\nvirt/kvm/Kconfig-67-\nvirt/kvm/Kconfig:68:config KVM_GENERIC_DIRTYLOG_READ_PROTECT\nvirt/kvm/Kconfig-69- bool\nvirt/kvm/Kconfig-70-\nvirt/kvm/Kconfig:71:config KVM_GENERIC_PRE_FAULT_MEMORY\nvirt/kvm/Kconfig-72- bool\nvirt/kvm/Kconfig-73-\nvirt/kvm/Kconfig:74:config KVM_COMPAT\nvirt/kvm/Kconfig-75- def_bool y\n--\nvirt/kvm/Kconfig=91=config HAVE_KVM_PM_NOTIFIER\n--\nvirt/kvm/Kconfig-93-\nvirt/kvm/Kconfig:94:config KVM_GENERIC_HARDWARE_ENABLING\nvirt/kvm/Kconfig-95- bool\nvirt/kvm/Kconfig-96-\nvirt/kvm/Kconfig:97:config KVM_ELIDE_TLB_FLUSH_IF_YOUNG\nvirt/kvm/Kconfig-98- bool\nvirt/kvm/Kconfig-99-\nvirt/kvm/Kconfig:100:config KVM_MMU_LOCKLESS_AGING\nvirt/kvm/Kconfig-101- bool\nvirt/kvm/Kconfig-102-\nvirt/kvm/Kconfig:103:config KVM_GENERIC_MEMORY_ATTRIBUTES\nvirt/kvm/Kconfig-104- bool\nvirt/kvm/Kconfig-105-\nvirt/kvm/Kconfig:106:config KVM_GUEST_MEMFD\nvirt/kvm/Kconfig-107- select XARRAY_MULTI\n"
} |
| 9/2 | 2026/07/01 06:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 21152 output: 21 thoughts: 324 Thoughts: **Analyzing KVM EFER Handling** Okay, so I'm looking at these KVM configurations: `KVM`, `KVM_INTEL`, and `KVM_AMD`. Hmm, `KVM` is a tristate, so let's just use the base `KVM` option, that's the most general. Now, the patch is touching `kvm_valid_efer` and `set_efer` within `arch/x86/kvm/msrs.c`. That's the core area of interest for EFER modifications. `kvm_valid_efer` is called by `kvm_is_valid_sregs` in `arch/x86/kvm/regs.c`, which gives us a good picture of where the validation takes place. And `set_efer` is called from `kvm_set_msr_common`, also in `arch/x86/kvm/msrs.c`. Digging deeper, `__set_sregs_common` in `arch/x86/kvm/regs.c` also calls `set_efer`, so it's a critical component. Therefore, the key symbols that warrant closer examination are clearly: * `kvm_valid_efer` * `set_efer` * `kvm_is_valid_sregs` * `__set_sregs_common` I'm double-checking the names to make sure I've got them right...yes, those are the functions. So I'll go ahead and check that `__set_sregs_common` in `arch/x86/kvm/regs.c`. |
| 10/2 | 2026/07/01 06:29 | tool | grepper |
0mArgs:{
"Expression": "__set_sregs_common"
}Results: {
"Output": "arch/x86/kvm/regs.c=544=static bool kvm_is_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)\n--\narch/x86/kvm/regs.c-569-\narch/x86/kvm/regs.c:570:static int __set_sregs_common(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs,\narch/x86/kvm/regs.c-571-\t\t\t int *mmu_reset_needed, bool update_pdptrs)\n--\narch/x86/kvm/regs.c=637=static int __set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)\n--\narch/x86/kvm/regs.c-640-\tint mmu_reset_needed = 0;\narch/x86/kvm/regs.c:641:\tint ret = __set_sregs_common(vcpu, sregs, \u0026mmu_reset_needed, true);\narch/x86/kvm/regs.c-642-\n--\narch/x86/kvm/regs.c=678=int kvm_vcpu_ioctl_x86_set_sregs2(struct kvm_vcpu *vcpu,\n--\narch/x86/kvm/regs.c-692-\narch/x86/kvm/regs.c:693:\tret = __set_sregs_common(vcpu, (struct kvm_sregs *)sregs2,\narch/x86/kvm/regs.c-694-\t\t\t\t \u0026mmu_reset_needed, !valid_pdptrs);\n"
} |
| 11/2 | 2026/07/01 06:29 | llm | patch-evaluator |
0mModel:gemini-3.1-pro-preview Args: null Results: null Tokens: input: 22331 output: 214 thoughts: 335 Thoughts: **My Assessment of the KVM x86 EFER MSR Handling Modification** Okay, so the patch is focusing on `__set_sregs_common` – that seems like a good starting point. Let's dig in and see how it impacts the x86 EFER MSR handling within KVM. Right, `set_efer` is what I need to look at. And yes, there it is in `arch/x86/kvm/msrs.c`. It's static, but as expected, `kvm_set_msr_common` calls it for `MSR_EFER`, which is exactly what I'm interested in. I also see that `kvm_valid_efer` is exported. So, the key functions to focus on are: * `kvm_valid_efer` * `set_efer` * `kvm_is_valid_sregs` * `__set_sregs_common` These are the functions that will need close scrutiny. The changes involve altering how supported EFER bits are checked and set. It seems like the patch replaces `efer_reserved_bits` with `kvm_caps.supported_efer_bits`. The patch also introduces `setup_efer_caps` to `kvm_x86_ops`. This has implications for `kvm_valid_efer`, `set_efer`, and `kvm_is_valid_sregs`, which are all reached during VM execution and state restoration. This is a functional change to the core KVM logic, and that means we *absolutely* need to include this in the fuzzing strategy. One more thing. We need to make sure we've covered the configs. The patch is clearly affecting x86, so `KVM`, `KVM_AMD`, and `KVM_INTEL` are usually needed to run KVM on x86, so I'll include them. Let's log the findings and get this set up for fuzzing. |
| 12/2 | 2026/07/01 06:29 | tool | set-results |
0mArgs:{
"EnableConfigs": [
"KVM",
"KVM_AMD",
"KVM_INTEL"
],
"FocusSymbols": [
"kvm_valid_efer",
"set_efer",
"kvm_is_valid_sregs",
"__set_sregs_common"
],
"Reasoning": "The patch modifies KVM x86 EFER MSR handling, specifically how supported EFER bits are checked and set. It replaces `efer_reserved_bits` with `kvm_caps.supported_efer_bits` and introduces `setup_efer_caps` to `kvm_x86_ops`. This affects `kvm_valid_efer`, `set_efer`, and `kvm_is_valid_sregs`, which are reachable during VM execution and state restoration. This is a functional change to core KVM logic and should be fuzzed.",
"WorthFuzzing": true
}Results: {
"EnableConfigs": [
"KVM",
"KVM_AMD",
"KVM_INTEL"
],
"FocusSymbols": [
"kvm_valid_efer",
"set_efer",
"kvm_is_valid_sregs",
"__set_sregs_common"
],
"Reasoning": "The patch modifies KVM x86 EFER MSR handling, specifically how supported EFER bits are checked and set. It replaces `efer_reserved_bits` with `kvm_caps.supported_efer_bits` and introduces `setup_efer_caps` to `kvm_x86_ops`. This affects `kvm_valid_efer`, `set_efer`, and `kvm_is_valid_sregs`, which are reachable during VM execution and state restoration. This is a functional change to core KVM logic and should be fuzzed.",
"WorthFuzzing": true
} |
| Total Calls | Total Tokens | Avg Tokens | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|
| Total Calls | Total Duration (Seconds) | Avg Duration (Seconds) |
|---|