WSLC: Enforce read-only VirtioFS shares at the device host level#14464
WSLC: Enforce read-only VirtioFS shares at the device host level#14464benhillis wants to merge 2 commits intofeature/wsl-for-appsfrom
Conversation
| 0); | ||
|
|
||
| // Verify the folder is still not writeable. | ||
| ExpectCommandResult(session.get(), {"/bin/sh", "-c", "echo -n content > /win-path/file.txt"}, 1); |
There was a problem hiding this comment.
I verified that this testcase fails without the new devicehost .dll.
There was a problem hiding this comment.
Pull request overview
This PR strengthens read-only VirtioFS share enforcement in WSLA by passing a read-only option to the DeviceHost-backed virtiofs device, and adds regression tests to ensure guest-side remount attempts cannot bypass host-enforced read-only.
Changes:
- Pass a read-only (“ro”) option to
GuestDeviceManager::AddGuestDevicewhen creating VirtioFS shares marked read-only. - Extend WSLA Windows-mount tests to cover remount and unmount+remount bypass attempts for read-only mounts.
- Update
Microsoft.WSL.DeviceHostNuGet package to1.1.39-0.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/windows/WSLATests.cpp | Adds new tests validating read-only enforcement against guest-side remount/bypass attempts. |
| src/windows/wslaservice/exe/HcsVirtualMachine.cpp | Supplies “ro” device-host option when creating read-only VirtioFS shares. |
| packages.config | Bumps DeviceHost package version to pick up required enforcement behavior. |
You can also share your feedback on Copilot code review. Take the survey.
796dbce to
23f2948
Compare
There was a problem hiding this comment.
Pull request overview
This PR ensures read-only VirtioFS Windows folder shares are enforced by the device host (not just guest mount flags), preventing guest-side remounts from re-enabling writes. It updates the DeviceHost dependency and extends the WSLA test suite to validate the enforcement behavior.
Changes:
- Passes the
rooption toGuestDeviceManager::AddGuestDevicewhen creating read-only VirtioFS shares. - Updates
Microsoft.WSL.DeviceHostNuGet package to1.1.39-0. - Adds WSLA tests covering read-only enforcement across
remount,rwand unmount+remount attempts.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/windows/WSLATests.cpp | Adds coverage to ensure read-only Windows mounts remain non-writable even after guest remount/remount-bypass attempts. |
| test/windows/Common.cpp | Expands WER dump capture process list to include dllhost.exe during hang reporting. |
| src/windows/wslaservice/exe/HcsVirtualMachine.cpp | Adds ro option propagation to the VirtioFS device-host creation path for read-only shares. |
| packages.config | Bumps Microsoft.WSL.DeviceHost package version to pick up the enforcement behavior. |
You can also share your feedback on Copilot code review. Take the survey.
| L"wslc.exe", | ||
| L"dllhost.exe"}; |
There was a problem hiding this comment.
this is temporary, I am trying to track down the hang.
Pass the 'ro' option to AddGuestDevice when mounting a read-only VirtioFS share, ensuring the device host enforces write protection regardless of guest-side mount operations. Updated DeviceHost package to 1.1.39-0. Added tests for read-only mount enforcement via remount and unmount+remount.
21d1b61 to
fecd474
Compare
Pass the 'ro' option to AddGuestDevice when mounting a read-only VirtioFS share, ensuring the device host enforces write protection regardless of guest-side mount operations.
Updated DeviceHost package to 1.1.39-0. Added tests for read-only mount enforcement via remount and unmount+remount.