DF-5409 / verdict.json
{ "finding_id": "DF-5409", "status": "reproduced", "verdict": "Reproduced as a gate-completeness gap: cpu_sanitize_frames rflags mask (vkernel64 cpu_regs.c:316 and the running pc64 host mirror machdep.c:916, disassembled live: and $0x274dd5) whitelists PSL_VM_UNSUPP, so an EFLAGS.VM=1 rflags survives both the vkernels and the hosts sanitize and is loaded by the host return-to-user. Runtime proof: 20,000 consecutive vmspace_ctl(VMSPACE_CTL_RUN) frames with rflags=0x20246 were accepted and their nested contexts executed (frames loaded, not rejected). The trap.c pass-2 claim that cpu_sanitize_frame gates the DF-5335 route is verified COMPLETE for CS/SS/IOPL/NT but INCOMPLETE for VM. On this rigs CPU (Skylake/KVM) the loaded VM bit is silently masked (iretvm probe), so impact is none here; on SDM-enforcing hardware the same frame yields a kernel-mode #GP at the host doreti iretq (IDTVEC(prot)/doreti_iret_fault special case = DF-5335 territory), reachable from an unprivileged guest user via sigreturn (DF-5408) or, with vm.vkernel_enable=1, directly via vmspace_ctl.", "reproduced": true, "impact": "none", "confidence": "certain", "exploit_chain": "guest user -> vmspace_create + vmspace_ctl(RUN, frame{rflags.VM=1}) (needs guest-root sysctl vm.vkernel_enable=1; or no precondition via the DF-5408 sigreturn bypass) -> vkernel cpu_sanitize_frame keeps VM (mask 0x274dd5) -> go_user -> host vmspace_ctl -> host cpu_sanitize_frame keeps VM (running-kernel disasm 0x274dd5) -> host return-to-user loads rflags with VM -> masked here; SDM hardware: #GP(0) at doreti iretq -> espfix special case.", "evidence": "disasm_host.txt (running host kernel mask 0x274dd5), disasm_vk_baseline.txt (vkernel mask 0x274dd5), run_suite.log mode 2 (20k VM frames accepted, nested context executed at poisoned rip), disasm_vk_fixed.txt (post-fix mask 0x254dd5), iretvm.c hardware probe in DF-5408 pack", "kernel_refs": [ "sys/platform/vkernel64/x86_64/cpu_regs.c:316", "sys/platform/pc64/x86_64/machdep.c:916", "sys/vm/vm_vmspace.c:298", "sys/platform/pc64/x86_64/trap.c:680", "sys/platform/pc64/x86_64/ipl.s:212" ], "poc_changes": "No seed; evidence generated with the DF-5408 rig (vmflag.c mode 2 loop + running-kernel disassembly of both sanitize sites).", "attempts": 3, "guest_uname": "DragonFly dfbsd 6.5-DEVELOPMENT DragonFly 6.5-DEVELOPMENT #0: Thu Jul 2 06:02:54 UTC 2026 root@dfbsd:/usr/obj/usr/src/sys/X86_64_GENERIC x86_64", "runtime_sec": 900, "guest_dirty": 1, "build_cmd": "see DF-5408 pack (shared rig)", "run_cmd": "sh run_suite.sh baseline (vmflag mode 2)", "code_hash": "ca21e7001a7df69bdf6f37d3e91230e33bd5f3a4560886334b8d2ca3aee1fae0", "notes": "The gate-completeness verification requested by the trap.c pass-2 audits: COMPLETE for CS/SS (forced), IOPL/VM-except-this-bit/privileged rflags (masked); INCOMPLETE for PSL_VM_UNSUPP only. PSL_T/AC/NT/RF intentionally user-changeable and handled elsewhere. Direct vmspace_ctl vector additionally requires vm.vkernel_enable=1 inside the vkernel (guest-root); the sigreturn vector (DF-5408) has no such precondition.", "recommended_fix": "Remove PSL_VM_UNSUPP from cpu_sanitize_frames rflags mask in both vkernel64 cpu_regs.c:316 and pc64 machdep.c:916 (included in DF-5408/fix.diff).", "fix_status": "fixed", "fix_baseline_reproduced": true, "fix_patched_reproduced": false, "fix_verdict": "fixed", "fix_evidence": "disasm_vk_fixed.txt: rebuilt vkernel mask 0x254dd5 (0x20000 removed) after applying fix.diff; run_fixed.log mode 2 completes with frames sanitized." } |