Run saved state cleanup as user (#41259)
Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: eed677b2-73d4-445c-b738-16123e81897b
Ben Hillis committed
Aug 5, 2026 at 13:21 UTC
2570b98b3b8466b0d3adc91e678f047c3b233d8f
1 file changed
+1
src/windows/service/exe/HcsVirtualMachine.cpp
+1
@@ -391,6 +391,7 @@ HcsVirtualMachine::~HcsVirtualMachine()
391
{
392
try
393
{
394
+ auto runAsUser = wil::impersonate_token(m_userToken.get());
395
WI_ASSERT(std::filesystem::is_empty(m_vmSavedStateFile));
396
std::filesystem::remove(m_vmSavedStateFile);
397
}