mirror of https://github.com/microsoft/WSL
Merge remote-tracking branch 'origin/master' into HEAD
This commit is contained in:
commit
4f0a65ab95
|
|
@ -29,7 +29,7 @@ parameters:
|
|||
type: object
|
||||
default:
|
||||
- target: "wsl;libwsl;wslg;wslservice;wslhost;wslrelay;wslinstaller;wslinstall;initramfs;wslserviceproxystub;wslsettings;wslinstallerproxystub;testplugin;wslaclient;wsltests"
|
||||
pattern: "wsl.exe,libwsl.dll,wslg.exe,wslservice.exe,wslhost.exe,wslrelay.exe,wslinstaller.exe,wslinstall.dll,wslserviceproxystub.dll,wslsettings.dll,wslsettings.exe,wslinstallerproxystub.dll,wsldevicehost.dll,WSLDVCPlugin.dll,testplugin.dll,wsldeps.dll,wslaclient.dll"
|
||||
pattern: "wsl.exe,libwsl.dll,wslg.exe,wslservice.exe,wslhost.exe,wslrelay.exe,wslinstaller.exe,wslinstall.dll,wslserviceproxystub.dll,wslsettings/wslsettings.dll,wslsettings/wslsettings.exe,wslinstallerproxystub.dll,wsldevicehost.dll,WSLDVCPlugin.dll,testplugin.dll,wsldeps.dll,wslaclient.dll"
|
||||
- target: "msixgluepackage"
|
||||
pattern: "gluepackage.msix"
|
||||
- target: "msipackage"
|
||||
|
|
@ -125,6 +125,11 @@ stages:
|
|||
ob_sdl_codeSignValidation_excludes: -|**testbin\**
|
||||
Codeql.PublishDatabaseLog: true
|
||||
Codeql.SourceRoot: src
|
||||
packageStagingDir: '$(Build.SourcesDirectory)\packageStagingDir'
|
||||
${{ if eq(parameters.isRelease, 'true') }}:
|
||||
packageInputDirArg: '-DPACKAGE_INPUT_DIR=$(packageStagingDir)'
|
||||
${{ else }}:
|
||||
packageInputDirArg: ''
|
||||
|
||||
steps:
|
||||
|
||||
|
|
@ -171,7 +176,7 @@ stages:
|
|||
displayName: "CMake ${{ platform }}"
|
||||
inputs:
|
||||
workingDirectory: "."
|
||||
cmakeArgs: . --fresh -A ${{ platform }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_VERSION=10.0.26100.0 -DPACKAGE_VERSION=$(version.WSL_PACKAGE_VERSION) -DWSL_NUGET_PACKAGE_VERSION=$(version.WSL_NUGET_PACKAGE_VERSION) -DSKIP_PACKAGE_SIGNING=${{ parameters.isRelease }} -DOFFICIAL_BUILD=${{ parameters.isRelease }} -DPIPELINE_BUILD_ID=$(Build.BuildId) -DVSO_ORG=${{ parameters.vsoOrg }} -DVSO_PROJECT=${{ parameters.vsoProject }} -DWSL_BUILD_WSL_SETTINGS=true
|
||||
cmakeArgs: . --fresh -A ${{ platform }} -DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_VERSION=10.0.26100.0 -DPACKAGE_VERSION=$(version.WSL_PACKAGE_VERSION) -DWSL_NUGET_PACKAGE_VERSION=$(version.WSL_NUGET_PACKAGE_VERSION) -DSKIP_PACKAGE_SIGNING=${{ parameters.isRelease }} -DOFFICIAL_BUILD=${{ parameters.isRelease }} -DPIPELINE_BUILD_ID=$(Build.BuildId) -DVSO_ORG=${{ parameters.vsoOrg }} -DVSO_PROJECT=${{ parameters.vsoProject }} -DWSL_BUILD_WSL_SETTINGS=true $(packageInputDirArg)\${{ platform }}
|
||||
|
||||
# This additional Restore NuGet package task is added as a workaround for WSL Settings to have its packages restored properly.
|
||||
# Without this, building wsl settings may encounter the following error:
|
||||
|
|
@ -201,7 +206,7 @@ stages:
|
|||
AuthSignCertName: ${{ parameters.esrp.AuthSignCertName }}
|
||||
AppRegistrationClientId: ${{ parameters.esrp.AppRegistrationClientId }}
|
||||
AppRegistrationTenantId: ${{ parameters.esrp.AppRegistrationTenantId }}
|
||||
FolderPath: "bin\\${{ platform }}"
|
||||
FolderPath: "bin\\${{ platform }}\\Release"
|
||||
Pattern: "${{ target.pattern }}"
|
||||
UseMSIAuthentication: true
|
||||
EsrpClientId: ${{ parameters.esrp.EsrpClientId }}
|
||||
|
|
@ -229,20 +234,27 @@ stages:
|
|||
}
|
||||
]
|
||||
|
||||
# Replace the intermediate wslsettings binaries file with the signed versions so that any future steps building wslsettings will use the signed versions
|
||||
- task: PowerShell@2
|
||||
displayName: 'Replace wslsettings binaries in intermediate folder with signed versions'
|
||||
condition: and(succeeded(), eq('${{ parameters.isRelease }}', true))
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
$arch = '${{ platform }}'
|
||||
$wslsettingsbinpath = "bin\$arch\release\wslsettings"
|
||||
$wslsettingsobjpath = "src\windows\wslsettings\obj\$arch\release"
|
||||
# Update the timestamp of wslsettings.exe so that it doesn't get rebuilt
|
||||
(Get-Item $wslsettingsbinpath\wslsettings.exe).LastWriteTime = Get-Date
|
||||
Copy-Item $wslsettingsbinpath\wslsettings.dll $wslsettingsobjpath\wslsettings.dll -Force
|
||||
Copy-Item $wslsettingsbinpath\wslsettings.exe $wslsettingsobjpath\apphost.exe -Force
|
||||
- task: PowerShell@2
|
||||
displayName: "Copy signed ${{ target.target }} to staging (${{ platform }})"
|
||||
condition: and(succeeded(), eq('${{ parameters.isRelease }}', true))
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
$arch = '${{ platform }}'
|
||||
$pattern = '${{ target.pattern }}'
|
||||
$inputDir = "bin\$arch\Release"
|
||||
$outputDir = "$(packageStagingDir)\$arch"
|
||||
New-Item -ItemType Directory -Path "$outputDir\wslsettings" -Force
|
||||
foreach ($file in $pattern.Split(',')) {
|
||||
$sourcePath = Join-Path $inputDir $file
|
||||
if (Test-Path $sourcePath) {
|
||||
$destPath = Join-Path $outputDir $file
|
||||
Write-Host "Copying signed file: $sourcePath -> $destPath"
|
||||
Copy-Item -Path $sourcePath -Destination $destPath -Force
|
||||
} else {
|
||||
Write-Warning "File not found: $sourcePath"
|
||||
}
|
||||
}
|
||||
|
||||
- script: cmake --build . --config Release -- -m
|
||||
displayName: "Build installer msix and tests (${{ platform }})"
|
||||
|
|
@ -388,7 +400,7 @@ stages:
|
|||
Move-Item -Path "bin\x64\cloudtest" -Destination "$(ob_outputDirectory)\testbin\x64\cloudtest"
|
||||
Move-Item -Path "tools\test\test-setup.ps1" -Destination "$(ob_outputDirectory)\testbin\test-setup.ps1"
|
||||
Move-Item -Path "tools\test\CloudTest-Setup.bat" -Destination "$(ob_outputDirectory)\testbin\CloudTest-Setup.bat"
|
||||
Move-Item -Path "tools\wsl.wprp" -Destination "$(ob_outputDirectory)\testbin\wsl.wprp"
|
||||
Move-Item -Path "diagnostics\wsl.wprp" -Destination "$(ob_outputDirectory)\testbin\wsl.wprp"
|
||||
Move-Item -Path "test\linux\unit_tests" -Destination "$(ob_outputDirectory)\testbin\unit_tests"
|
||||
|
||||
Move-Item -Path bundle\release\* -Destination $(ob_outputDirectory)\bundle
|
||||
|
|
@ -417,3 +429,4 @@ stages:
|
|||
|
||||
- task: CodeQL3000Finalize@0
|
||||
condition: ${{ and(parameters.isNightly, eq(variables['Build.SourceBranch'], 'refs/heads/main'))}}
|
||||
|
||||
|
|
|
|||
153
NOTICE.txt
153
NOTICE.txt
|
|
@ -643,6 +643,159 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||
Microsoft.NETCore.App.Runtime.win-arm64 10.0.0 - MIT
|
||||
|
||||
|
||||
Copyright (c) 2021
|
||||
Copyright (c) Six Labors
|
||||
(c) Microsoft Corporation
|
||||
Copyright (c) 2022 FormatJS
|
||||
Copyright (c) Andrew Arnott
|
||||
Copyright 2019 LLVM Project
|
||||
Copyright (c) 1998 Microsoft
|
||||
Copyright 2018 Daniel Lemire
|
||||
Copyright (c) .NET Foundation
|
||||
Copyright 1995-2022 Mark Adler
|
||||
Copyright 1995-2024 Mark Adler
|
||||
Copyright (c) 2011, Google Inc.
|
||||
Copyright (c) 2020 Dan Shechter
|
||||
(c) 1997-2005 Sean Eron Anderson
|
||||
Copyright (c) 2015 Andrew Gallant
|
||||
Copyright (c) 2022, Wojciech Mula
|
||||
Copyright (c) 2017 Yoshifumi Kawai
|
||||
Copyright (c) 2022, Geoff Langdale
|
||||
Copyright (c) 2005-2020 Rich Felker
|
||||
Copyright (c) 2012-2021 Yann Collet
|
||||
Copyright (c) Microsoft Corporation
|
||||
Copyright (c) 2007 James Newton-King
|
||||
Copyright (c) 1991-2024 Unicode, Inc.
|
||||
Copyright (c) 2013-2017, Alfred Klomp
|
||||
Copyright (c) 2018 Nemanja Mijailovic
|
||||
Copyright 2012 the V8 project authors
|
||||
Copyright (c) 1999 Lucent Technologies
|
||||
Copyright (c) 2008-2016, Wojciech Mula
|
||||
Copyright (c) 2011-2020 Microsoft Corp
|
||||
Copyright (c) 2015-2017, Wojciech Mula
|
||||
Copyright (c) 2015-2018, Wojciech Mula
|
||||
Copyright (c) 2005-2007, Nick Galbreath
|
||||
Copyright (c) 2015 The Chromium Authors
|
||||
Copyright (c) 2018 Alexander Chermyanin
|
||||
Copyright (c) The Internet Society 1997
|
||||
Copyright (c) 2004-2006 Intel Corporation
|
||||
Copyright (c) 2011-2015 Intel Corporation
|
||||
Copyright (c) 2013-2017, Milosz Krajewski
|
||||
Copyright (c) 2016-2017, Matthieu Darbois
|
||||
Copyright (c) The Internet Society (2003)
|
||||
Copyright (c) .NET Foundation Contributors
|
||||
(c) 1995-2024 Jean-loup Gailly and Mark Adler
|
||||
Copyright (c) 2020 Mara Bos <m-ou.se@m-ou.se>
|
||||
Copyright (c) .NET Foundation and Contributors
|
||||
Copyright (c) 2012 - present, Victor Zverovich
|
||||
Copyright (c) 2006 Jb Evain (jbevain@gmail.com)
|
||||
Copyright (c) 2008-2020 Advanced Micro Devices, Inc.
|
||||
Copyright (c) 2019 Microsoft Corporation, Daan Leijen
|
||||
Copyright (c) 2011 Novell, Inc (http://www.novell.com)
|
||||
Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com)
|
||||
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors
|
||||
Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com
|
||||
Copyright 1995-2024 Jean-loup Gailly and Mark Adler Qkkbal
|
||||
Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
|
||||
Portions (c) International Organization for Standardization 1986
|
||||
Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang) Disclaimers
|
||||
Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip
|
||||
Copyright (c) 1980, 1986, 1993 The Regents of the University of California
|
||||
Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California
|
||||
Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) .NET Foundation and Contributors
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
---------------------------------------------------------
|
||||
|
||||
---------------------------------------------------------
|
||||
|
||||
Microsoft.NETCore.App.Runtime.win-x64 10.0.0 - MIT
|
||||
|
||||
|
||||
Copyright (c) 2021
|
||||
Copyright (c) Six Labors
|
||||
(c) Microsoft Corporation
|
||||
Copyright (c) 2022 FormatJS
|
||||
Copyright (c) Andrew Arnott
|
||||
Copyright 2019 LLVM Project
|
||||
Copyright (c) 1998 Microsoft
|
||||
Copyright 2018 Daniel Lemire
|
||||
Copyright (c) .NET Foundation
|
||||
Copyright 1995-2022 Mark Adler
|
||||
Copyright 1995-2024 Mark Adler
|
||||
Copyright (c) 2011, Google Inc.
|
||||
Copyright (c) 2020 Dan Shechter
|
||||
(c) 1997-2005 Sean Eron Anderson
|
||||
Copyright (c) 2015 Andrew Gallant
|
||||
Copyright (c) 2022, Wojciech Mula
|
||||
Copyright (c) 2017 Yoshifumi Kawai
|
||||
Copyright (c) 2022, Geoff Langdale
|
||||
Copyright (c) 2005-2020 Rich Felker
|
||||
Copyright (c) 2012-2021 Yann Collet
|
||||
Copyright (c) Microsoft Corporation
|
||||
Copyright (c) 2007 James Newton-King
|
||||
Copyright (c) 1991-2024 Unicode, Inc.
|
||||
Copyright (c) 2013-2017, Alfred Klomp
|
||||
Copyright (c) 2018 Nemanja Mijailovic
|
||||
Copyright 2012 the V8 project authors
|
||||
Copyright (c) 1999 Lucent Technologies
|
||||
Copyright (c) 2008-2016, Wojciech Mula
|
||||
Copyright (c) 2011-2020 Microsoft Corp
|
||||
Copyright (c) 2015-2017, Wojciech Mula
|
||||
Copyright (c) 2015-2018, Wojciech Mula
|
||||
Copyright (c) 2005-2007, Nick Galbreath
|
||||
Copyright (c) 2015 The Chromium Authors
|
||||
Copyright (c) 2018 Alexander Chermyanin
|
||||
Copyright (c) The Internet Society 1997
|
||||
Copyright (c) 2004-2006 Intel Corporation
|
||||
Copyright (c) 2011-2015 Intel Corporation
|
||||
Copyright (c) 2013-2017, Milosz Krajewski
|
||||
Copyright (c) 2016-2017, Matthieu Darbois
|
||||
Copyright (c) The Internet Society (2003)
|
||||
Copyright (c) .NET Foundation Contributors
|
||||
(c) 1995-2024 Jean-loup Gailly and Mark Adler
|
||||
Copyright (c) 2020 Mara Bos <m-ou.se@m-ou.se>
|
||||
Copyright (c) .NET Foundation and Contributors
|
||||
Copyright (c) 2012 - present, Victor Zverovich
|
||||
Copyright (c) 2006 Jb Evain (jbevain@gmail.com)
|
||||
Copyright (c) 2008-2020 Advanced Micro Devices, Inc.
|
||||
Copyright (c) 2019 Microsoft Corporation, Daan Leijen
|
||||
Copyright (c) 2011 Novell, Inc (http://www.novell.com)
|
||||
Copyright (c) 2015 Xamarin, Inc (http://www.xamarin.com)
|
||||
Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors
|
||||
Copyright (c) 2014 Ryan Juckett http://www.ryanjuckett.com
|
||||
Copyright 1995-2024 Jean-loup Gailly and Mark Adler Qkkbal
|
||||
Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
|
||||
Portions (c) International Organization for Standardization 1986
|
||||
Copyright (c) YEAR W3C(r) (MIT, ERCIM, Keio, Beihang) Disclaimers
|
||||
Copyright (c) 2015 THL A29 Limited, a Tencent company, and Milo Yip
|
||||
Copyright (c) 1980, 1986, 1993 The Regents of the University of California
|
||||
Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018 The Regents of the University of California
|
||||
Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. & Digital Equipment Corporation, Maynard, Mass
|
||||
|
||||
The MIT License (MIT)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
<EventProvider Id="wslclient" Name="8cbb7724-7223-5d6f-8137-564dac45104d"/>
|
||||
<EventProvider Id="wslaservice" Name="0383CE62-8F86-4766-AFB2-9D66A7FB1E90"/>
|
||||
<EventProvider Id="wslapi" Name="beb94edf-1a7b-5058-0696-ff9e6b1798d1"/>
|
||||
<EventProvider Id="vfpext" Name="9F2660EA-CFE7-428F-9850-AECA612619B0" />
|
||||
<EventProvider Id="vm_chipset" Name="de9ba731-7f33-4f44-98c9-6cac856b9f83"/>
|
||||
<EventProvider Id="vmcompute_dll" Name="AF7FD3A7-B248-460C-A9F5-FEC39EF8468C"/>
|
||||
<EventProvider Id="vmcompute" Name="17103E3F-3C6E-4677-BB17-3B267EB5BE57"/>
|
||||
|
|
@ -20,7 +21,7 @@
|
|||
<EventProvider Id="vmwp" Name="51DDFA29-D5C8-4803-BE4B-2ECB715570FE"/>
|
||||
<EventProvider Id="9p" Name="e13c8d52-b153-571f-78c5-1d4098af2a1e"/>
|
||||
<EventProvider Id="9p_errors" Name="06C601B3-6957-4F8C-A15F-74875B24429D" />
|
||||
<EventProvider Id="p9rdr" Name="bb1d36f0-e0e0-48cc-9493-fef0e3d0b28c" />
|
||||
<EventProvider Id="p9rdr" Name="bb1d36f0-e0e0-48cc-9493-fef0e3d0b28c" NonPagedMemory="true" Strict="true"/>
|
||||
<EventProvider Id="mup" Name="20c46239-d059-4214-a11e-7d6769cbe020" />
|
||||
<EventProvider Id="rfsmon" Name="51734B23-5B7E-4892-BA8E-45BC110B735C" />
|
||||
<EventProvider Id="hyperv_storage" Name="c7ad62c6-5c99-5a1b-bbc4-0821ae5b765e" />
|
||||
|
|
@ -116,6 +117,7 @@
|
|||
<EventProviderId Value="wsl_devicehost"/>
|
||||
<EventProviderId Value="wslclient"/>
|
||||
<EventProviderId Value="wslapi"/>
|
||||
<EventProviderId Value="vfpext"/>
|
||||
<EventProviderId Value="vm_chipset"/>
|
||||
<EventProviderId Value="vmcompute_dll"/>
|
||||
<EventProviderId Value="vmcompute"/>
|
||||
|
|
|
|||
|
|
@ -1194,7 +1194,7 @@ Zie de herstelinstructies voor: https://aka.ms/wsldiskmountrecovery</value>
|
|||
<value>Een absoluut Windows-pad naar een aangepaste Linux-kernel.</value>
|
||||
</data>
|
||||
<data name="Settings_CustomKernelPathBrowseButton.Content" xml:space="preserve">
|
||||
<value>Koor kernels bladeren</value>
|
||||
<value>Door kernels bladeren</value>
|
||||
</data>
|
||||
<data name="Settings_CustomKernelPathTextBox.AutomationProperties.Name" xml:space="preserve">
|
||||
<value>Aangepaste kernel</value>
|
||||
|
|
|
|||
|
|
@ -1,16 +1,29 @@
|
|||
set(BIN ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE})
|
||||
|
||||
# For pipeline builds, use PACKAGE_INPUT_DIR if specified (contains signed binaries)
|
||||
# For local builds, use bin directory
|
||||
if(DEFINED PACKAGE_INPUT_DIR)
|
||||
message(STATUS "Using signed binaries from ${PACKAGE_INPUT_DIR} for MSI packaging")
|
||||
else()
|
||||
set(PACKAGE_INPUT_DIR ${BIN})
|
||||
endif()
|
||||
|
||||
set(OUTPUT_PACKAGE ${BIN}/wsl.msi)
|
||||
set(PACKAGE_WIX_IN ${CMAKE_CURRENT_LIST_DIR}/package.wix.in)
|
||||
set(PACKAGE_WIX ${BIN}/package.wix)
|
||||
set(CAB_CACHE ${BIN}/cab)
|
||||
set(BINARIES wsl.exe;wslg.exe;wslhost.exe;wslrelay.exe;wslservice.exe;wslserviceproxystub.dll;init;initrd.img;wslinstall.dll;wslaserviceproxystub.dll;wslaservice.exe;wsladiag.exe)
|
||||
|
||||
set(WINDOWS_BINARIES wsl.exe;wslg.exe;wslhost.exe;wslrelay.exe;wslservice.exe;wslserviceproxystub.dll;wslinstall.dll;wslaservice.exe;wsladiag.exe)
|
||||
if (WSL_BUILD_WSL_SETTINGS)
|
||||
list(APPEND BINARIES_DEPENDENCIES "wslsettings/wslsettings.dll;wslsettings/wslsettings.exe;libwsl.dll")
|
||||
list(APPEND WINDOWS_BINARIES "wslsettings/wslsettings.dll;wslsettings/wslsettings.exe;libwsl.dll")
|
||||
endif()
|
||||
|
||||
set(BINARIES_DEPENDENCIES)
|
||||
foreach(binary ${BINARIES})
|
||||
foreach(binary ${WINDOWS_BINARIES})
|
||||
list(APPEND BINARIES_DEPENDENCIES "${PACKAGE_INPUT_DIR}/${binary}")
|
||||
endforeach()
|
||||
|
||||
set(LINUX_BINARIES init;initrd.img)
|
||||
foreach(binary ${LINUX_BINARIES})
|
||||
list(APPEND BINARIES_DEPENDENCIES "${BIN}/${binary}")
|
||||
endforeach()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Package Name="Windows Subsystem for Linux" Language="1033" InstallerVersion="500" Version="${PACKAGE_VERSION}" Manufacturer="Microsoft Corporation" UpgradeCode="6D5B792B-1EDC-4DE9-8EAD-201B820F8E82" Scope="perMachine" Compressed="${COMPRESS_PACKAGE}">
|
||||
<MajorUpgrade AllowDowngrades="yes" Disallow="no" />
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
|
|
@ -19,22 +19,22 @@
|
|||
<DirectoryRef Id="INSTALLDIR">
|
||||
<Component Id="wsl" Guid="F0C8D6BA-1502-41E7-BF72-D93DFA134730" UninstallWhenSuperseded="yes" DisableRegistryReflection="yes" Bitness="always64">
|
||||
<RemoveFile Id="CleanUpWSLShortCut" Directory="ProgramMenuFolder" Name="WSL" On="uninstall"/>
|
||||
<File Id="wsl.exe" Name="wsl.exe" Source="${BIN}/wsl.exe" KeyPath="yes">
|
||||
<File Id="wsl.exe" Name="wsl.exe" Source="${PACKAGE_INPUT_DIR}/wsl.exe" KeyPath="yes">
|
||||
<Shortcut Id="WSLShortcut" Name="WSL" Description="Windows Subsystem for Linux" Arguments="--cd ~" Advertise="yes" Directory="ProgramMenuFolder" Icon="wsl.ico">
|
||||
<ShortcutProperty Key="System.AppUserModel.ID" Value="Microsoft.WSL"/>
|
||||
<ShortcutProperty Key="System.AppUserModel.ToastActivatorCLSID" Value="{2B9C59C3-98F1-45C8-B87B-12AE3C7927E8}"/>
|
||||
</Shortcut>
|
||||
</File>
|
||||
|
||||
<File Id="wslg.exe" Name="wslg.exe" Source="${BIN}/wslg.exe" />
|
||||
<File Id="wsladiag.exe" Name="wsladiag.exe" Source="${BIN}/wsladiag.exe" />
|
||||
<File Id="wslhost.exe" Name="wslhost.exe" Source="${BIN}/wslhost.exe" />
|
||||
<File Id="wslrelay.exe" Name="wslrelay.exe" Source="${BIN}/wslrelay.exe" />
|
||||
<File Id="wslserviceproxystub.dll" Name="wslserviceproxystub.dll" Source="${BIN}/wslserviceproxystub.dll" />
|
||||
<File Id="wsldeps.dll" Name="wsldeps.dll" Source="${BIN}/wsldeps.dll" />
|
||||
<File Id="wslg.exe" Name="wslg.exe" Source="${PACKAGE_INPUT_DIR}/wslg.exe" />
|
||||
<File Id="wsladiag.exe" Name="wsladiag.exe" Source="${PACKAGE_INPUT_DIR}/wsladiag.exe" />
|
||||
<File Id="wslhost.exe" Name="wslhost.exe" Source="${PACKAGE_INPUT_DIR}/wslhost.exe" />
|
||||
<File Id="wslrelay.exe" Name="wslrelay.exe" Source="${PACKAGE_INPUT_DIR}/wslrelay.exe" />
|
||||
<File Id="wslserviceproxystub.dll" Name="wslserviceproxystub.dll" Source="${PACKAGE_INPUT_DIR}/wslserviceproxystub.dll" />
|
||||
<File Id="wsldeps.dll" Name="wsldeps.dll" Source="${PACKAGE_INPUT_DIR}/wsldeps.dll" />
|
||||
|
||||
<?if "${WSL_BUILD_WSL_SETTINGS}" = "true" ?>
|
||||
<File Id="libwsl.dll" Name="libwsl.dll" Source="${BIN}/libwsl.dll" />
|
||||
<File Id="libwsl.dll" Name="libwsl.dll" Source="${PACKAGE_INPUT_DIR}/libwsl.dll" />
|
||||
<?endif?>
|
||||
|
||||
<?if "${WSL_DEV_BINARY_PATH}" = "" ?>
|
||||
|
|
@ -231,7 +231,7 @@
|
|||
</RegistryKey>
|
||||
|
||||
<!-- Session 0 service -->
|
||||
<File Id="wslservice.exe" Source="${BIN}/wslservice.exe" KeyPath="yes" />
|
||||
<File Id="wslservice.exe" Source="${PACKAGE_INPUT_DIR}/wslservice.exe" KeyPath="yes" />
|
||||
<ServiceInstall Name="WSLService" DisplayName="WSL Service" Description="WSL Service" Start="auto" Type="ownProcess" ErrorControl="normal" Account="LocalSystem" Vital="yes" Interactive="no" />
|
||||
|
||||
<!-- The service is stopped on uninstall and upgrade.
|
||||
|
|
@ -414,8 +414,8 @@
|
|||
<File Id="rdpnanoTransport.dll" Source="${MSRDC_SOURCE_DIR}/${TARGET_PLATFORM}/rdpnanoTransport.dll" />
|
||||
<File Id="RdpWinStlHelper.dll" Source="${MSRDC_SOURCE_DIR}/${TARGET_PLATFORM}/RdpWinStlHelper.dll" />
|
||||
<?endif?>
|
||||
<File Id="wsldevicehost.dll" Source="${BIN}/wsldevicehost.dll" />
|
||||
<File Id="${WSLG_TS_PLUGIN_DLL}" Source="${BIN}/${WSLG_TS_PLUGIN_DLL}" />
|
||||
<File Id="wsldevicehost.dll" Source="${PACKAGE_INPUT_DIR}/wsldevicehost.dll" />
|
||||
<File Id="${WSLG_TS_PLUGIN_DLL}" Source="${PACKAGE_INPUT_DIR}/${WSLG_TS_PLUGIN_DLL}" />
|
||||
|
||||
<!-- MSRDC Plugin registration -->
|
||||
<RegistryKey Root="HKLM" Key="SOFTWARE\Microsoft\Terminal Server Client\Default\OptionalAddIns\WSLDVC_PACKAGE">
|
||||
|
|
@ -465,7 +465,7 @@
|
|||
<ComponentGroup Id="wslsettings" Directory="WSLSETTINGS" Source="${BIN}/wslsettings">
|
||||
<Component Id="wslsettingsnonserver" Guid="AB166073-8855-492B-95C8-C6E5939B66A5" Bitness="always64" DisableRegistryReflection="yes" UninstallWhenSuperseded="yes" Condition="MsiNTProductType = 1">
|
||||
<RemoveFile Id="CleanUpWSLSettingsShortCutNonServer" Directory="ProgramMenuFolder" Name="WSLSettings" On="uninstall"/>
|
||||
<File Id="wslsettings.exe_nonserver" Source="${BIN}/wslsettings/wslsettings.exe" KeyPath="yes" ShortName="kyk8fs6a.exe">
|
||||
<File Id="wslsettings.exe_nonserver" Source="${PACKAGE_INPUT_DIR}/wslsettings/wslsettings.exe" KeyPath="yes" ShortName="kyk8fs6a.exe">
|
||||
<Shortcut Id="WSLSettingsShortcutNonServer" Name="WSL Settings" Description="Windows Subsystem for Linux Settings" Advertise="yes" Directory="ProgramMenuFolder" Icon="wsl.ico">
|
||||
<ShortcutProperty Key="System.AppUserModel.IsSystemComponent" Value="true"/>
|
||||
</Shortcut>
|
||||
|
|
@ -496,7 +496,7 @@
|
|||
</Component>
|
||||
<Component Id="wslsettingsserver" Guid="EE2D69A0-4F55-4EC5-9576-4FAD70BC798E" Bitness="always64" DisableRegistryReflection="yes" UninstallWhenSuperseded="yes" Condition="MsiNTProductType > 1">
|
||||
<RemoveFile Id="CleanUpWSLSettingsShortCutServer" Directory="ProgramMenuFolder" Name="WSLSettings" On="uninstall"/>
|
||||
<File Id="wslsettings.exe_server" Source="${BIN}/wslsettings/wslsettings.exe" KeyPath="yes" ShortName="kyk8fs6b.exe">
|
||||
<File Id="wslsettings.exe_server" Source="${PACKAGE_INPUT_DIR}/wslsettings/wslsettings.exe" KeyPath="yes" ShortName="kyk8fs6b.exe">
|
||||
<Shortcut Id="WSLSettingsShortcutServer" Name="WSL Settings" Description="Windows Subsystem for Linux Settings" Advertise="yes" Directory="ProgramMenuFolder" Icon="wsl.ico"/>
|
||||
</File>
|
||||
<!-- Protocol registration -->
|
||||
|
|
@ -523,7 +523,10 @@
|
|||
</RegistryKey>
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
<Files Include="*.dll"/>
|
||||
<File Id="wslsettings.dll" Source="${PACKAGE_INPUT_DIR}/wslsettings/wslsettings.dll"/>
|
||||
<Files Include="*.dll">
|
||||
<Exclude Files="wslsettings.dll" />
|
||||
</Files>
|
||||
<Files Include="*.exe">
|
||||
<Exclude Files="wslsettings.exe" />
|
||||
</Files>
|
||||
|
|
@ -559,8 +562,8 @@
|
|||
|
||||
</Feature>
|
||||
|
||||
<Binary Id="wslinstall.dll" SourceFile="${BIN}/wslinstall.dll" />
|
||||
<Binary Id="msixpackage" SourceFile="${BIN}/gluepackage.msix"/>
|
||||
<Binary Id="wslinstall.dll" SourceFile="${PACKAGE_INPUT_DIR}/wslinstall.dll" />
|
||||
<Binary Id="msixpackage" SourceFile="${PACKAGE_INPUT_DIR}/gluepackage.msix"/>
|
||||
|
||||
<CustomAction Id="ValidateInstall"
|
||||
Impersonate="no"
|
||||
|
|
@ -733,3 +736,4 @@
|
|||
<Property Id="MSIRMSHUTDOWN" Value="0" Secure="yes" />
|
||||
</Package>
|
||||
</Wix>
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
#include <netinet/ip.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <linux/unistd.h>
|
||||
#include <linux/sock_diag.h>
|
||||
#include <linux/inet_diag.h>
|
||||
#include <lxwil.h>
|
||||
#include <linux/if_tun.h>
|
||||
|
||||
|
|
@ -21,85 +23,67 @@
|
|||
#include "SecCompDispatcher.h"
|
||||
#include "seccomp_defs.h"
|
||||
#include "CommandLine.h"
|
||||
#include "NetlinkChannel.h"
|
||||
#include "NetlinkTransactionError.h"
|
||||
|
||||
#define TCP_LISTEN 10
|
||||
|
||||
namespace {
|
||||
|
||||
std::vector<sockaddr_storage> ParseTcpFile(int family, FILE* file)
|
||||
std::vector<sockaddr_storage> QueryListeningSockets(NetlinkChannel& channel)
|
||||
{
|
||||
char* line = nullptr;
|
||||
auto freeLine = wil::scope_exit([&line]() { free(line); });
|
||||
|
||||
// Skip the first line which contains a header.
|
||||
size_t lineLength = 0;
|
||||
auto bytesRead = getline(&line, &lineLength, file);
|
||||
THROW_LAST_ERROR_IF(bytesRead < 0);
|
||||
|
||||
// Each line contains information about TCP sockets on the system, the fields
|
||||
// we are interested are for sockets that are or have been listening:
|
||||
// 1: Socket address and port number
|
||||
// 3: Socket status
|
||||
std::vector<sockaddr_storage> sockets{};
|
||||
while ((bytesRead = getline(&line, &lineLength, file)) != -1)
|
||||
try
|
||||
{
|
||||
sockaddr_storage sock{};
|
||||
int index = 0;
|
||||
int status = 0;
|
||||
for (char *sp, *field = strtok_r(line, " \n", &sp); field != nullptr; field = strtok_r(NULL, " \n", &sp))
|
||||
inet_diag_req_v2 message{};
|
||||
message.sdiag_protocol = IPPROTO_TCP;
|
||||
message.idiag_states = (1 << TCP_LISTEN);
|
||||
|
||||
auto onMessage = [&](const NetlinkResponse& response) {
|
||||
for (const auto& e : response.Messages<inet_diag_msg>(SOCK_DIAG_BY_FAMILY))
|
||||
{
|
||||
const auto* payload = e.Payload();
|
||||
sockaddr_storage sock{};
|
||||
|
||||
if (payload->idiag_family == AF_INET)
|
||||
{
|
||||
auto* ipv4 = reinterpret_cast<sockaddr_in*>(&sock);
|
||||
ipv4->sin_family = AF_INET;
|
||||
ipv4->sin_addr.s_addr = payload->id.idiag_src[0];
|
||||
ipv4->sin_port = payload->id.idiag_sport;
|
||||
}
|
||||
else if (payload->idiag_family == AF_INET6)
|
||||
{
|
||||
auto* ipv6 = reinterpret_cast<sockaddr_in6*>(&sock);
|
||||
ipv6->sin6_family = AF_INET6;
|
||||
static_assert(sizeof(ipv6->sin6_addr.s6_addr32) == sizeof(payload->id.idiag_src));
|
||||
memcpy(ipv6->sin6_addr.s6_addr32, payload->id.idiag_src, sizeof(ipv6->sin6_addr.s6_addr32));
|
||||
ipv6->sin6_port = payload->id.idiag_sport;
|
||||
}
|
||||
|
||||
sockets.emplace_back(sock);
|
||||
}
|
||||
};
|
||||
|
||||
// Query IPv4 listening sockets.
|
||||
{
|
||||
if (index == 1)
|
||||
{
|
||||
int port;
|
||||
const char* portString = strchr(field, ':');
|
||||
if (portString == nullptr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
portString += 1;
|
||||
port = static_cast<int>(strtol(portString, nullptr, 16));
|
||||
if (port == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (family == AF_INET)
|
||||
{
|
||||
sockaddr_in ipv4Sock{};
|
||||
ipv4Sock.sin_family = family;
|
||||
ipv4Sock.sin_addr.s_addr = strtol(field, nullptr, 16);
|
||||
ipv4Sock.sin_port = port;
|
||||
memcpy(&sock, &ipv4Sock, sizeof(ipv4Sock));
|
||||
}
|
||||
else if (family == AF_INET6)
|
||||
{
|
||||
sockaddr_in6 ipv6Sock{};
|
||||
ipv6Sock.sin6_family = family;
|
||||
ipv6Sock.sin6_port = port;
|
||||
for (int part = 0; part < 4; ++part)
|
||||
{
|
||||
char next[5];
|
||||
next[4] = 0;
|
||||
memcpy(next, field + part * 4, 4);
|
||||
ipv6Sock.sin6_addr.__in6_union.__s6_addr32[part] = strtol(next, nullptr, 16);
|
||||
}
|
||||
memcpy(&sock, &ipv6Sock, sizeof(ipv6Sock));
|
||||
}
|
||||
}
|
||||
else if (index == 3)
|
||||
{
|
||||
status = static_cast<int>(strtol(field, nullptr, 16));
|
||||
break;
|
||||
}
|
||||
|
||||
index += 1;
|
||||
message.sdiag_family = AF_INET;
|
||||
auto transaction = channel.CreateTransaction(message, SOCK_DIAG_BY_FAMILY, NLM_F_DUMP);
|
||||
transaction.Execute(onMessage);
|
||||
}
|
||||
|
||||
if ((status == TCP_LISTEN) && (sock.ss_family != 0))
|
||||
// Query IPv6 listening sockets.
|
||||
{
|
||||
sockets.emplace_back(sock);
|
||||
message.sdiag_family = AF_INET6;
|
||||
auto transaction = channel.CreateTransaction(message, SOCK_DIAG_BY_FAMILY, NLM_F_DUMP);
|
||||
transaction.Execute(onMessage);
|
||||
}
|
||||
}
|
||||
catch (const NetlinkTransactionError& e)
|
||||
{
|
||||
// Log but don't fail - network state might be temporarily unavailable
|
||||
LOG_ERROR("Failed to query listening sockets via sock_diag: {}", e.what());
|
||||
}
|
||||
|
||||
return sockets;
|
||||
}
|
||||
|
|
@ -127,12 +111,12 @@ LX_GNS_PORT_LISTENER_RELAY SockToRelayMessage(const sockaddr_storage& sock)
|
|||
{
|
||||
auto ipv4 = reinterpret_cast<const sockaddr_in*>(&sock);
|
||||
message.Address[0] = ipv4->sin_addr.s_addr;
|
||||
message.Port = ipv4->sin_port;
|
||||
message.Port = ntohs(ipv4->sin_port);
|
||||
}
|
||||
else if (sock.ss_family == AF_INET6)
|
||||
{
|
||||
auto ipv6 = reinterpret_cast<const sockaddr_in6*>(&sock);
|
||||
message.Port = ipv6->sin6_port;
|
||||
message.Port = ntohs(ipv6->sin6_port);
|
||||
memcpy(message.Address, ipv6->sin6_addr.__in6_union.__s6_addr, sizeof(message.Address));
|
||||
}
|
||||
return message;
|
||||
|
|
@ -177,53 +161,23 @@ bool IsSameSockAddr(const sockaddr_storage& left, const sockaddr_storage& right)
|
|||
{
|
||||
auto leftIpv6 = reinterpret_cast<const sockaddr_in6*>(&left);
|
||||
auto rightIpv6 = reinterpret_cast<const sockaddr_in6*>(&right);
|
||||
if (leftIpv6->sin6_port != rightIpv6->sin6_port)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
for (int part = 0; part < 4; ++part)
|
||||
{
|
||||
if (leftIpv6->sin6_addr.__in6_union.__s6_addr32[part] != rightIpv6->sin6_addr.__in6_union.__s6_addr32[part])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
FATAL_ERROR("Unrecognized socket family {}", left.ss_family);
|
||||
return false;
|
||||
return (leftIpv6->sin6_port == rightIpv6->sin6_port && memcmp(&leftIpv6->sin6_addr, &rightIpv6->sin6_addr, sizeof(in6_addr)) == 0);
|
||||
}
|
||||
|
||||
FATAL_ERROR("Unrecognized socket family {}", left.ss_family);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Start looking for ports bound to localhost or wildcard.
|
||||
int ScanProcNetTCP(wsl::shared::SocketChannel& channel)
|
||||
// Monitor listening TCP sockets using sock_diag netlink interface.
|
||||
int MonitorListeningSockets(wsl::shared::SocketChannel& channel)
|
||||
{
|
||||
// Periodically scan procfs for listening TCP sockets.
|
||||
NetlinkChannel netlinkChannel(SOCK_RAW, NETLINK_SOCK_DIAG);
|
||||
std::vector<sockaddr_storage> relays{};
|
||||
int result = 0;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
std::vector<sockaddr_storage> sockets;
|
||||
wil::unique_file tcp4File{fopen("/proc/net/tcp", "r")};
|
||||
if (tcp4File)
|
||||
{
|
||||
sockets = ParseTcpFile(AF_INET, tcp4File.get());
|
||||
}
|
||||
|
||||
wil::unique_file tcp6File{fopen("/proc/net/tcp6", "r")};
|
||||
if (tcp6File)
|
||||
{
|
||||
auto ipv6Sockets = ParseTcpFile(AF_INET6, tcp6File.get());
|
||||
sockets.insert(sockets.end(), ipv6Sockets.begin(), ipv6Sockets.end());
|
||||
}
|
||||
|
||||
if (!tcp4File && !tcp6File)
|
||||
{
|
||||
LOG_ERROR("Failed to open /proc/net/tcp and /proc/net/tcp6, closing port relay");
|
||||
return 1;
|
||||
}
|
||||
auto sockets = QueryListeningSockets(netlinkChannel);
|
||||
|
||||
// Stop any relays that no longer match listening ports.
|
||||
std::erase_if(relays, [&](const auto& entry) {
|
||||
|
|
@ -267,9 +221,7 @@ int ScanProcNetTCP(wsl::shared::SocketChannel& channel)
|
|||
}
|
||||
|
||||
// Sleep before scanning again.
|
||||
//
|
||||
// TODO: Investigate using EBPF notifications instead of a sleep.
|
||||
sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
@ -433,7 +385,7 @@ try
|
|||
|
||||
if (ScanForPorts)
|
||||
{
|
||||
return ScanProcNetTCP(channel);
|
||||
return MonitorListeningSockets(channel);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -1755,8 +1755,10 @@ void WslCoreVm::InitializeGuest()
|
|||
{
|
||||
try
|
||||
{
|
||||
m_guestDeviceManager->AddSharedMemoryDevice(
|
||||
VIRTIO_FS_CLASS_ID, L"wslg", L"wslg", WSLG_SHARED_MEMORY_SIZE_MB, m_userToken.get());
|
||||
// Use the appropriate virtiofs class ID based on m_userToken elevation.
|
||||
const bool admin = wsl::windows::common::security::IsTokenElevated(m_userToken.get());
|
||||
const GUID classId = admin ? VIRTIO_FS_ADMIN_CLASS_ID : VIRTIO_FS_CLASS_ID;
|
||||
m_guestDeviceManager->AddSharedMemoryDevice(classId, L"wslg", L"wslg", WSLG_SHARED_MEMORY_SIZE_MB, m_userToken.get());
|
||||
m_sharedMemoryRoot = std::format(L"WSL\\{}\\wslg", m_machineId);
|
||||
}
|
||||
CATCH_LOG()
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ public:
|
|||
SKIP_TEST_ARM64();
|
||||
|
||||
TerminateDistribution();
|
||||
WslKeepAlive keelAlive;
|
||||
WslKeepAlive keepAlive;
|
||||
|
||||
ValidateDrvfsMounts(CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT, Mode);
|
||||
}
|
||||
|
|
@ -288,7 +288,7 @@ public:
|
|||
SKIP_TEST_ARM64();
|
||||
|
||||
TerminateDistribution();
|
||||
WslKeepAlive keelAlive;
|
||||
WslKeepAlive keepAlive;
|
||||
|
||||
ValidateDrvfsMounts(CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT | CREATE_NEW_CONSOLE, Mode);
|
||||
}
|
||||
|
|
@ -302,7 +302,7 @@ public:
|
|||
TerminateDistribution();
|
||||
|
||||
const auto nonElevatedToken = GetNonElevatedToken();
|
||||
WslKeepAlive keelAlive(nonElevatedToken.get());
|
||||
WslKeepAlive keepAlive(nonElevatedToken.get());
|
||||
|
||||
ValidateDrvfsMounts(CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT, Mode);
|
||||
}
|
||||
|
|
@ -316,11 +316,37 @@ public:
|
|||
TerminateDistribution();
|
||||
|
||||
const auto nonElevatedToken = GetNonElevatedToken();
|
||||
WslKeepAlive keelAlive(nonElevatedToken.get());
|
||||
WslKeepAlive keepAlive(nonElevatedToken.get());
|
||||
|
||||
ValidateDrvfsMounts(CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT | CREATE_NEW_CONSOLE, Mode);
|
||||
}
|
||||
|
||||
void DrvfsMountElevatedSystemDistroEnabled(DrvFsMode Mode)
|
||||
{
|
||||
WSL2_TEST_ONLY();
|
||||
WINDOWS_11_TEST_ONLY(); // TODO: Enable on Windows 10 when virtio support is added
|
||||
SKIP_TEST_ARM64();
|
||||
|
||||
WslConfigChange config(LxssGenerateTestConfig({.guiApplications = true, .drvFsMode = Mode}));
|
||||
WslKeepAlive keepAlive;
|
||||
|
||||
ValidateDrvfsMounts(CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT, Mode);
|
||||
}
|
||||
|
||||
void DrvfsMountNonElevatedSystemDistroEnabled(DrvFsMode Mode)
|
||||
{
|
||||
WSL2_TEST_ONLY();
|
||||
WINDOWS_11_TEST_ONLY(); // TODO: Enable on Windows 10 when virtio support is added
|
||||
SKIP_TEST_ARM64();
|
||||
|
||||
WslConfigChange config(LxssGenerateTestConfig({.guiApplications = true, .drvFsMode = Mode}));
|
||||
|
||||
const auto nonElevatedToken = GetNonElevatedToken();
|
||||
WslKeepAlive keepAlive(nonElevatedToken.get());
|
||||
|
||||
ValidateDrvfsMounts(CREATE_UNICODE_ENVIRONMENT | EXTENDED_STARTUPINFO_PRESENT, Mode);
|
||||
}
|
||||
|
||||
static void XattrDrvFs(DrvFsMode Mode)
|
||||
{
|
||||
SKIP_TEST_ARM64();
|
||||
|
|
@ -946,6 +972,31 @@ private:
|
|||
|
||||
const auto nonElevatedToken = GetNonElevatedToken();
|
||||
validate(nonElevatedType, nonElevatedToken.get());
|
||||
|
||||
// Elevated token should be able to create files at the root of the drive (/mnt/c)
|
||||
{
|
||||
const auto commandLine =
|
||||
LxssGenerateWslCommandLine(L"touch /mnt/c/elevated_test_file.tmp && rm /mnt/c/elevated_test_file.tmp");
|
||||
|
||||
wsl::windows::common::SubProcess process(nullptr, commandLine.c_str(), CreateProcessFlags);
|
||||
process.SetToken(nullptr);
|
||||
process.SetShowWindow(SW_HIDE);
|
||||
|
||||
const auto output = process.RunAndCaptureOutput();
|
||||
VERIFY_ARE_EQUAL(0, output.ExitCode, L"Elevated token should be able to create files at /mnt/c");
|
||||
}
|
||||
|
||||
// Non-elevated token should NOT be able to create files at the root of the drive (/mnt/c)
|
||||
{
|
||||
const auto commandLine = LxssGenerateWslCommandLine(L"touch /mnt/c/nonelevated_test_file.tmp");
|
||||
|
||||
wsl::windows::common::SubProcess process(nullptr, commandLine.c_str(), CreateProcessFlags);
|
||||
process.SetToken(nonElevatedToken.get());
|
||||
process.SetShowWindow(SW_HIDE);
|
||||
|
||||
const auto output = process.RunAndCaptureOutput();
|
||||
VERIFY_ARE_NOT_EQUAL(0, output.ExitCode, L"Non-elevated token should NOT be able to create files at /mnt/c (C:\\)");
|
||||
}
|
||||
}
|
||||
|
||||
static VOID VerifyDrvFsSymlink(const std::wstring& Path, const std::wstring& ExpectedTarget, bool Directory)
|
||||
|
|
@ -1198,6 +1249,18 @@ class WSL1 : public DrvFsTests
|
|||
WSL2_TEST_ONLY(); \
|
||||
DrvFsTests::DrvfsMountNonElevatedDifferentConsole(DrvFsMode::##_mode##); \
|
||||
} \
|
||||
\
|
||||
TEST_METHOD(DrvfsMountElevatedSystemDistroEnabled) \
|
||||
{ \
|
||||
WSL2_TEST_ONLY(); \
|
||||
DrvFsTests::DrvfsMountElevatedSystemDistroEnabled(DrvFsMode::##_mode##); \
|
||||
} \
|
||||
\
|
||||
TEST_METHOD(DrvfsMountNonElevatedSystemDistroEnabled) \
|
||||
{ \
|
||||
WSL2_TEST_ONLY(); \
|
||||
DrvFsTests::DrvfsMountNonElevatedSystemDistroEnabled(DrvFsMode::##_mode##); \
|
||||
} \
|
||||
\
|
||||
TEST_METHOD(XattrDrvFs) \
|
||||
{ \
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -71,23 +71,41 @@ if ($Package) {
|
|||
try {
|
||||
if ($AllowUnsigned)
|
||||
{
|
||||
# unfortunately -AllowUnsigned isn't supported on vb so we need to manually import the certificate and trust it.
|
||||
(Get-AuthenticodeSignature $Package).SignerCertificate | Export-Certificate -FilePath private-wsl.cert | Out-Null
|
||||
try
|
||||
{
|
||||
Import-Certificate -FilePath .\private-wsl.cert -CertStoreLocation Cert:\LocalMachine\Root | Out-Null
|
||||
# Try to add with -AllowUnsigned first (supported in newer PowerShell)
|
||||
try {
|
||||
Add-AppxPackage $Package -AllowUnsigned -ErrorAction Stop
|
||||
}
|
||||
finally
|
||||
{
|
||||
Remove-Item -Path .\private-wsl.cert
|
||||
catch {
|
||||
# Fallback: manually import the certificate and trust it
|
||||
Write-Host "Attempting to import package certificate..."
|
||||
$signature = Get-AuthenticodeSignature -LiteralPath $Package
|
||||
if (-not $signature.SignerCertificate) {
|
||||
Write-Error "Package is not signed or has no certificate. Cannot import certificate."
|
||||
exit 1
|
||||
}
|
||||
|
||||
$cert = $signature.SignerCertificate
|
||||
$certPath = Join-Path $env:TEMP "wsl-package-cert.cer"
|
||||
try {
|
||||
$cert | Export-Certificate -FilePath $certPath | Out-Null
|
||||
Import-Certificate -FilePath $certPath -CertStoreLocation Cert:\LocalMachine\Root | Out-Null
|
||||
Write-Host "Certificate imported successfully. Retrying package installation..."
|
||||
}
|
||||
finally {
|
||||
Remove-Item -Path $certPath -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# Retry installation after importing certificate
|
||||
Add-AppxPackage $Package -ErrorAction Stop
|
||||
}
|
||||
}
|
||||
|
||||
Add-AppxPackage $Package
|
||||
else {
|
||||
Add-AppxPackage $Package -ErrorAction Stop
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host $_
|
||||
Get-AppPackageLog -All
|
||||
Write-Host "Error installing package: $_"
|
||||
Get-AppPackageLog | Select-Object -First 64 | Format-List
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,92 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<WindowsPerformanceRecorder Version="1">
|
||||
<Profiles>
|
||||
<EventCollector Id="Collector" Name="Collector">
|
||||
<BufferSize Value="256"/>
|
||||
<Buffers Value="1024"/>
|
||||
</EventCollector>
|
||||
|
||||
<EventProvider Id="lxcore_kernel" Name="0CD1C309-0878-4515-83DB-749843B3F5C9"/>
|
||||
<EventProvider Id="lxcore_user" Name="D90B9468-67F0-5B3B-42CC-82AC81FFD960"/>
|
||||
<EventProvider Id="lxcore_service" Name="B99CDB5A-039C-5046-E672-1A0DE0A40211"/>
|
||||
<EventProvider Id="vm_chipset" Name="de9ba731-7f33-4f44-98c9-6cac856b9f83"/>
|
||||
<EventProvider Id="vmcompute_dll" Name="AF7FD3A7-B248-460C-A9F5-FEC39EF8468C"/>
|
||||
<EventProvider Id="vmcompute" Name="17103E3F-3C6E-4677-BB17-3B267EB5BE57"/>
|
||||
<EventProvider Id="vmmm" Name="6066F867-7CA1-4418-85FD-36E3F9C0600C"/>
|
||||
<EventProvider Id="vmwp" Name="51DDFA29-D5C8-4803-BE4B-2ECB715570FE"/>
|
||||
<EventProvider Id="9p" Name="e13c8d52-b153-571f-78c5-1d4098af2a1e"/>
|
||||
<EventProvider Id="p9rdr" Name="bb1d36f0-e0e0-48cc-9493-fef0e3d0b28c" NonPagedMemory="true" Strict="true"/>
|
||||
<EventProvider Id="mup" Name="20c46239-d059-4214-a11e-7d6769cbe020" />
|
||||
<EventProvider Id="rfsmon" Name="51734B23-5B7E-4892-BA8E-45BC110B735C" />
|
||||
<EventProvider Id="hyperv_storage" Name="c7ad62c6-5c99-5a1b-bbc4-0821ae5b765e" />
|
||||
<EventProvider Id="hns" Name="0c885e0d-6eb6-476c-a048-2457eed3a5c1" />
|
||||
<EventProvider Id="wsl_devicehost" Name="9d6c7b9e-2581-4d8a-b8c5-b90b4a17094a"/>
|
||||
<EventProvider Id="vfpext" Name="9F2660EA-CFE7-428F-9850-AECA612619B0" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Mobile.Provisioning.AppDownload" Name="0BBE6221-EF09-4A3F-82EE-BE00DBB6A98A" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Mobile.Provisioning.Datastore" Name="42C60CEA-0FE7-4541-A86B-9E11F95BD9BF" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Mobile.Provisioning.PhoneProvisioner" Name="B876B1FC-C7F1-443E-9012-86677F7DE580" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Mobile.Provisioning.PPOEM" Name="7EDBED09-1FF7-4FEE-B8C3-5DB694420830" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.API" Name="82ADD491-01D7-4B85-9EAD-192C3CAACA23" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.CSP" Name="16E12400-A2D8-44B7-9479-004568EC7819" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.Engine" Name="A6A847B7-4429-49AA-BBA6-2AD8C191AC8C" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.Handlers" Name="0383D92C-2337-4F25-A0B5-A51767F04746" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.Migration" Name="A0AF985E-83F9-4E1A-B658-338DCFE27893" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.Operations" Name="7F99598F-B2C1-4371-9911-63DEE13B9EB1" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.Platform" Name="B1F30020-8BC3-4888-BB1B-4DD681F24209" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.Plugin.Engine" Name="55239D60-0EB6-495B-874E-15DE5D5F9A70" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.Plugin.RemovableMedia" Name="B55883E6-6C45-45C2-AB9D-800BB7B66B13" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.ProvTool" Name="2BF4B6BA-556E-4D05-8534-CAFEDF19FED8" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.CommandCsp" Name="00BB69FC-60BC-4502-9438-25608F375CCB" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.Provisioning.ProvLaunch" Name="08FACCFA-125D-4ED6-B0B7-B4A1A912E693" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.EMPS.Enrollment" Name="E74EFD1A-B62D-4B83-AB00-66F4A166A2D3" />
|
||||
<EventProvider Id="EventProvider_Microsoft.Windows.EnterpriseManagement.Enrollment" Name="F9E3B648-9AF1-4DC3-9A8E-BF42C0FBCE9A" />
|
||||
|
||||
<Profile
|
||||
Id="WSL.Verbose.File"
|
||||
Name="WSL"
|
||||
Description="Traces for all WSL components"
|
||||
LoggingMode="File"
|
||||
DetailLevel="Verbose"
|
||||
>
|
||||
<Collectors>
|
||||
<EventCollectorId Value="Collector">
|
||||
<EventProviders>
|
||||
<EventProviderId Value="lxcore_kernel"/>
|
||||
<EventProviderId Value="lxcore_user"/>
|
||||
<EventProviderId Value="lxcore_service"/>
|
||||
<EventProviderId Value="vm_chipset"/>
|
||||
<EventProviderId Value="vmcompute_dll"/>
|
||||
<EventProviderId Value="vmcompute"/>
|
||||
<EventProviderId Value="vmmm"/>
|
||||
<EventProviderId Value="vmwp"/>
|
||||
<EventProviderId Value="9p"/>
|
||||
<EventProviderId Value="p9rdr"/>
|
||||
<EventProviderId Value="mup"/>
|
||||
<EventProviderId Value="rfsmon"/>
|
||||
<EventProviderId Value="hyperv_storage"/>
|
||||
<EventProviderId Value="hns"/>
|
||||
<EventProviderId Value="wsl_devicehost"/>
|
||||
<EventProviderId Value="vfpext"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Mobile.Provisioning.AppDownload"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Mobile.Provisioning.Datastore"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Mobile.Provisioning.PhoneProvisioner"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Mobile.Provisioning.PPOEM"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Provisioning.CSP"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Provisioning.Engine"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Provisioning.Migration"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Provisioning.Platform"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Provisioning.Operations"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Provisioning.Plugin.Engine"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Provisioning.Plugin.RemovableMedia"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Provisioning.ProvTool"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Provisioning.Operations"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Provisioning.CommandCsp"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.Provisioning.ProvLaunch"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.EMPS.Enrollment"/>
|
||||
<EventProviderId Value="EventProvider_Microsoft.Windows.EnterpriseManagement.Enrollment"/>
|
||||
</EventProviders>
|
||||
</EventCollectorId>
|
||||
</Collectors>
|
||||
</Profile>
|
||||
</Profiles>
|
||||
</WindowsPerformanceRecorder>
|
||||
Loading…
Reference in New Issue