From dbb6a76dc021917323c46fc55f3c19f348d1ac07 Mon Sep 17 00:00:00 2001 From: xbzk Date: Sat, 27 Jun 2026 11:11:40 -0300 Subject: [PATCH] [hle/am] make Service::Process move-only to fix #3908 KProcess use-after-free --- src/core/hle/service/os/process.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/core/hle/service/os/process.h b/src/core/hle/service/os/process.h index ca10945f84..103ba7aa6c 100644 --- a/src/core/hle/service/os/process.h +++ b/src/core/hle/service/os/process.h @@ -6,6 +6,8 @@ #pragma once +#include + #include "common/common_types.h" namespace Core { @@ -28,6 +30,15 @@ public: inline explicit Process(Core::System& system) noexcept : m_system(system) {} inline ~Process() { this->Finalize(); } + Process(const Process&) = delete; + Process& operator=(const Process&) = delete; + Process& operator=(Process&&) = delete; + inline Process(Process&& other) noexcept + : m_system(other.m_system), m_process(std::exchange(other.m_process, nullptr)), + m_main_thread_stack_size(std::exchange(other.m_main_thread_stack_size, 0)), + m_main_thread_priority(std::exchange(other.m_main_thread_priority, 0)), + m_process_started(std::exchange(other.m_process_started, false)) {} + bool Initialize(Loader::AppLoader& loader, Loader::ResultStatus& out_load_result); void Finalize();