Repository navigation
doctor: KVM001, BIN001 and NET005 from the WSL 3.0.x issues - #121
Merged
Merged
Conversation
KVM001: nested virtualization asked for (the Windows 11 amd64 default, or .wslconfig) but no /dev/kvm and no vmx/svm in the VM. Names the October 2026 update that breaks it on AMD (KB5127648, builds .9711, microsoft/WSL#41917). Mirrors WslCoreConfig: never on Windows 10, off by default on arm64, off under safeMode or policy AllowNestedVirtualization=0. BIN001: WSLInterop missing or disabled in binfmt_misc, or another enabled handler claiming "MZ" or .exe (mono, wine; microsoft/WSL#41739). The table is the kernel's, so it is read once. NET005: with mirrored networking, the longest run of the TCP and UDP dynamic port ranges that no exclusion covers, against the 4096 ports WSL reserves (512 at least from 3.0.4, microsoft/WSL#41880). HNS's choice is undocumented; this measures the fragmentation microsoft/WSL#41812 traced. Collected: env.VM from one already-running WSL 2 distribution (never starts one), and netsh's dynamic and excluded port ranges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checks 4 to 6 from the WSL 3.0.x survey. Each is read-only, and none starts a distribution: the guest-side facts come from one that is already running, or the check is skipped.
KVM001: nested virtualization reaches the VM
WSL drops nested virtualization when the host can't provide it. The October 2026 cumulative update (KB5127648, builds ending
.9711) made it unable to on AMD hosts, and up to 3.0.3 WSL said nothing (microsoft/WSL#41917; 3.0.4 adds a warning, #41942).The check works out whether WSL will ask for nested virtualization the way
WslCoreConfigdoes: never on Windows 10, on by default on Windows 11 amd64, off on arm64, and off undersafeModeor policyAllowNestedVirtualization=0. It then reads/dev/kvm,vmx/svmandvendor_idin the VM. AMD on build ≥ 26100 at revision ≥ 9711 gets its own finding.BIN001: Windows programs launch from Linux
This reads the kernel's binfmt_misc table, which is shared by the whole VM (
ProtectBinfmtStatusin WSL's init). It fails ifWSLInteropis missing or disabled, and warns if another enabled handler claimsMZat offset 0 or.exe(microsoft/WSL#41739). If the distribution'swsl.confturns interop off, that's reported as OK.NET005: mirrored networking can reserve its port range
This only runs with
networkingMode=mirrored. WSL asks HNS for one contiguous run of 4096 TCP and UDP ports. Up to 3.0.3 a refusal means0x8007054fand no network; from 3.0.4 it halves the request down to 512 (#41880). The check computes the longest run of each dynamic range (fromnetsh) that no exclusion covers. HNS's choice is undocumented, and the check says so: it measures the fragmentation #41812 traced, and can't see ports that are merely in use.Verified
WSLInteropandpython3.14.:wkfake:M::MZ::/bin/false:.cmd.exelaunched from Linux then ran under/bin/false, and BIN001 warned and named it. Afterecho -1, interop worked again.WSLInteropand BIN001 failed with "is missing". I then restored it with WSL's own registration string, andcmd.exeran again..9711path and NET005's warn and fail paths. They need Windows 11 on AMD with the October update, and a mirrored host with a fragmented range. They're covered by table tests on the measured shapes..9711match, the MZ/.exematch, the disabled-entry check, the free-run computation, the 3.0.4 retry gate, the entry parser, the asterisked exclusion line) was broken in turn, and a test failed each time.netshoutput from this machine.