Update Microsoft.WSL.DeviceHost package to 1.2.20-0 (#40426)

Removes virtiofs MAP_SHARED workarounds in drvfs and vfsaccess unit tests now that the updated device host supports shared mmap on virtiofs without DAX. Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Ben Hillis committed May 5, 2026 at 14:08 UTC fbb21def4b0b15e85424afba8c317faf519497a3
3 files changed +9 -47
packages.config
+1 -1
@@ -18,7 +18,7 @@
18 <package id="Microsoft.WSL.bsdtar" version="0.0.2-2" />
19 <package id="Microsoft.WSL.Dependencies.amd64fre" version="10.0.27820.1000-250318-1700.rs-base2-hyp" targetFramework="native" />
20 <package id="Microsoft.WSL.Dependencies.arm64fre" version="10.0.27820.1000-250318-1700.rs-base2-hyp" targetFramework="native" />
21 - <package id="Microsoft.WSL.DeviceHost" version="1.2.14-0" />
21 + <package id="Microsoft.WSL.DeviceHost" version="1.2.20-0" />
22 <package id="Microsoft.WSL.Kernel" version="6.6.114.1-1" targetFramework="native" />
23 <package id="Microsoft.WSL.LinuxSdk" version="1.20.0" targetFramework="native" />
24 <package id="Microsoft.WSL.TestData" version="0.4.0" />
test/linux/unit_tests/drvfs.c
+2 -9
@@ -3644,15 +3644,8 @@ Return Value:
3644 LxtCheckMemoryEqual(Mapping, "MZ", 2);
3645 LxtCheckResult(munmap(Mapping, 2));
3646
3647 - if (g_LxtFsInfo.FsType != LxtFsTypeVirtioFs)
3648 - {
3649 - LxtCheckMapErrno(Mapping = mmap(NULL, 2, PROT_READ, MAP_SHARED, Fd, 0));
3650 - LxtCheckMemoryEqual(Mapping, "MZ", 2);
3651 - }
3652 - else
3653 - {
3654 - LxtLogInfo("TODO: virtiofs does not support MAP_SHARED");
3655 - }
3647 + LxtCheckMapErrno(Mapping = mmap(NULL, 2, PROT_READ, MAP_SHARED, Fd, 0));
3648 + LxtCheckMemoryEqual(Mapping, "MZ", 2);
3649
3650 ErrorExit:
3651 if (Mapping != MAP_FAILED)
test/linux/unit_tests/vfsaccess.c
+6 -37
@@ -458,10 +458,8 @@ int VfsAccessFileObjectChecks(PLXT_ARGS Args)
458 int Result;
459 int ResultActual;
460 int ResultExpected;
461 - bool VirtiofsNoDax;
461
462 LxtLogInfo("Fs type %d with dax = %d\n", g_LxtFsInfo.FsType, g_LxtFsInfo.Flags.Dax);
464 - VirtiofsNoDax = g_LxtFsInfo.FsType == LxtFsTypeVirtioFs && g_LxtFsInfo.Flags.Dax == 0;
463 memset(Files, -1, sizeof(Files));
464 LxtCheckResult(VfsAccessFileObjectOpenFiles(Files));
465 for (Index = 0; Index < VFS_FILE_OBJECT_COUNT; ++Index)
@@ -531,22 +529,15 @@ int VfsAccessFileObjectChecks(PLXT_ARGS Args)
529 // N.B. The Linux 9p client does not allow mapping shared if the file is
530 // opened for write.
531 //
534 - // N.B. The virtiofs device relies on fuse mapping which only supports
535 - // shared in the presence of DAX.
536 - //
532
533 ErrnoExpected = EACCES;
534 if (Files[Index].Flags == O_PATH)
535 {
536 ErrnoExpected = EBADF;
537 }
543 - else if (VirtiofsNoDax && (Files[Index].Flags == O_RDONLY || (Files[Index].Flags & O_ACCMODE) == O_RDWR))
544 - {
545 - ErrnoExpected = ENODEV;
546 - }
538
539 ResultExpected = -1;
549 - if (!VirtiofsNoDax && (((Files[Index].Flags & O_ACCMODE) == O_RDONLY) || ((Files[Index].Flags & O_ACCMODE) == O_RDWR)) &&
540 + if ((((Files[Index].Flags & O_ACCMODE) == O_RDONLY) || ((Files[Index].Flags & O_ACCMODE) == O_RDWR)) &&
541 ((Files[Index].Flags & O_PATH) == 0))
542 {
543
@@ -619,22 +610,15 @@ int VfsAccessFileObjectChecks(PLXT_ARGS Args)
610 //
611 // Validate map write shared and private
612 //
622 - // N.B. The virtiofs device relies on fuse mapping which only supports
623 - // shared in the presence of DAX.
624 - //
613
614 ErrnoExpected = EACCES;
615 if (Files[Index].Flags == O_PATH)
616 {
617 ErrnoExpected = EBADF;
618 }
631 - else if (VirtiofsNoDax && (Files[Index].Flags & O_ACCMODE) == O_RDWR)
632 - {
633 - ErrnoExpected = ENODEV;
634 - }
619
620 ResultExpected = -1;
637 - if (!VirtiofsNoDax && (Files[Index].Flags & O_ACCMODE) == O_RDWR)
621 + if ((Files[Index].Flags & O_ACCMODE) == O_RDWR)
622 {
623 ResultExpected = 1;
624 }
@@ -691,10 +675,8 @@ int VfsAccessFileObjectSymlinksChecks(PLXT_ARGS Args)
675 int Result;
676 int ResultActual;
677 int ResultExpected;
694 - bool VirtiofsNoDax;
678
679 LxtLogInfo("Fs type %d with dax = %d\n", g_LxtFsInfo.FsType, g_LxtFsInfo.Flags.Dax);
697 - VirtiofsNoDax = g_LxtFsInfo.FsType == LxtFsTypeVirtioFs && g_LxtFsInfo.Flags.Dax == 0;
680
681 memset(Files, -1, sizeof(Files));
682 LxtCheckResult(VfsAccessFileObjectOpenSymlinks(Files));
@@ -738,13 +720,9 @@ int VfsAccessFileObjectSymlinksChecks(PLXT_ARGS Args)
720 {
721 ErrnoExpected = EBADF;
722 }
741 - else if (VirtiofsNoDax && (Files[Index].Flags == O_RDONLY || (Files[Index].Flags & O_ACCMODE) == O_RDWR))
742 - {
743 - ErrnoExpected = ENODEV;
744 - }
723
724 ResultExpected = -1;
747 - if (!VirtiofsNoDax && (((Files[Index].Flags & O_ACCMODE) == O_RDONLY) || ((Files[Index].Flags & O_ACCMODE) == O_RDWR)) &&
725 + if ((((Files[Index].Flags & O_ACCMODE) == O_RDONLY) || ((Files[Index].Flags & O_ACCMODE) == O_RDWR)) &&
726 ((Files[Index].Flags & O_PATH) == 0))
727 {
728
@@ -770,13 +748,9 @@ int VfsAccessFileObjectSymlinksChecks(PLXT_ARGS Args)
748 {
749 ErrnoExpected = EBADF;
750 }
773 - else if (VirtiofsNoDax && (Files[Index].Flags & O_ACCMODE) == O_RDWR)
774 - {
775 - ErrnoExpected = ENODEV;
776 - }
751
752 ResultExpected = -1;
779 - if (!VirtiofsNoDax && (Files[Index].Flags & O_ACCMODE) == O_RDWR)
753 + if ((Files[Index].Flags & O_ACCMODE) == O_RDWR)
754 {
755 ResultExpected = 1;
756 }
@@ -852,16 +826,11 @@ int VfsAccessRemapReference(PLXT_ARGS Args)
826 char Buffer;
827 int FdReadOnly = -1;
828 int FdReadWrite = -1;
855 - int MapFlags;
829 void* MapResult;
830 void* MapReadOnly = NULL;
831 void* MapReadWrite = NULL;
832 void* RemappedMemory = NULL;
833 int Result;
861 - bool VirtiofsNoDax;
862 -
863 - VirtiofsNoDax = g_LxtFsInfo.FsType == LxtFsTypeVirtioFs && g_LxtFsInfo.Flags.Dax == 0;
864 - MapFlags = VirtiofsNoDax ? MAP_PRIVATE : MAP_SHARED;
834
835 //
836 // Open and map a file whose only reference is read only and open second
@@ -869,9 +838,9 @@ int VfsAccessRemapReference(PLXT_ARGS Args)
838 //
839
840 LxtCheckErrno(FdReadOnly = open(g_VfsFiles[VFS_ACCESS_REMAP_FILE].Name, O_RDONLY, 0));
872 - LxtCheckMapErrno(MapReadOnly = mmap(NULL, sizeof(Buffer), PROT_READ, MapFlags, FdReadOnly, 0));
841 + LxtCheckMapErrno(MapReadOnly = mmap(NULL, sizeof(Buffer), PROT_READ, MAP_SHARED, FdReadOnly, 0));
842 LxtCheckErrno(FdReadWrite = open(g_VfsFiles[VFS_ACCESS_REMAP_FILE].Name, O_RDWR, 0));
874 - LxtCheckMapErrno(MapReadWrite = mmap(NULL, sizeof(Buffer), PROT_READ | PROT_WRITE, MapFlags, FdReadWrite, 0));
843 + LxtCheckMapErrno(MapReadWrite = mmap(NULL, sizeof(Buffer), PROT_READ | PROT_WRITE, MAP_SHARED, FdReadWrite, 0));
844 LxtCheckMapErrno(RemappedMemory = mremap(MapReadWrite, sizeof(Buffer), PAGE_SIZE * 2, MREMAP_MAYMOVE));
845
846 ErrorExit: