Skip to content

Fix CreateInstance failure when Windows hosts file exceeds message size cap (2.7 backport)#40726

Merged
benhillis merged 1 commit into
release/2.7from
benhill/fix-hosts-2.7
Jun 6, 2026
Merged

Fix CreateInstance failure when Windows hosts file exceeds message size cap (2.7 backport)#40726
benhillis merged 1 commit into
release/2.7from
benhill/fix-hosts-2.7

Conversation

@benhillis
Copy link
Copy Markdown
Member

@benhillis benhillis commented Jun 5, 2026

Cherry-pick of #40718 for the 2.7 release branch.

Changes from master:

  • Replaced EMIT_USER_WARNING with LOG_HR_MSG (trace-only, no user-facing message)
  • Removed MessageHostsFileTooLarge localization string

Fixes #40696
Fixes #40700
Fixes #40699

…ze cap (#40718)

On Windows 10 where DNS tunneling is unavailable, the hosts file content
is embedded in the configuration message sent to the guest init. If the
hosts file exceeds the message size safety check (added in 2.7.x), the
guest rejects it causing E_UNEXPECTED.

Fix by:
- Skipping the hosts file content if it exceeds 8MB, with a user warning
- Bumping the message size cap from 4MB to 16MB as additional headroom

Fixes #40696
Fixes #40700
Fixes #40699

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 5, 2026 22:25
@benhillis benhillis requested a review from a team as a code owner June 5, 2026 22:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR backports the fix for WSL CreateInstance failures caused by embedding an oversized Windows hosts file into the init/config message on Windows 10 (where DNS tunneling isn’t available), and increases the socket receive-side message size safety cap to provide additional headroom.

Changes:

  • Add a size guard in GetWindowsHosts() to skip embedding the parsed hosts content when it grows beyond a configured threshold (logging instead).
  • Increase the shared socket RecvMessage() maximum accepted message size from 4 MiB to 16 MiB.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/windows/common/filesystem.cpp Adds an early-return guard to stop embedding very large parsed Windows hosts content.
src/shared/inc/socketshared.h Raises the receive-side socket message size cap to 16 MiB.

Comment thread src/windows/common/filesystem.cpp
Comment thread src/windows/common/filesystem.cpp
Comment thread src/windows/common/filesystem.cpp
@benhillis benhillis enabled auto-merge (squash) June 5, 2026 23:47
@benhillis benhillis merged commit 3698dff into release/2.7 Jun 6, 2026
8 checks passed
@benhillis benhillis deleted the benhill/fix-hosts-2.7 branch June 6, 2026 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants