From 275da52305dc3df27fa4df6a6bf9a7c99783758f Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 3 Jan 2022 08:59:27 -0800 Subject: [PATCH] kern: add missing debug mode check to WriteDebugProcessMemory --- libraries/libmesosphere/source/svc/kern_svc_debug.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/libmesosphere/source/svc/kern_svc_debug.cpp b/libraries/libmesosphere/source/svc/kern_svc_debug.cpp index eb4c04845..043306a78 100644 --- a/libraries/libmesosphere/source/svc/kern_svc_debug.cpp +++ b/libraries/libmesosphere/source/svc/kern_svc_debug.cpp @@ -277,6 +277,9 @@ namespace ams::kern::svc { } Result WriteDebugProcessMemory(ams::svc::Handle debug_handle, uintptr_t buffer, uintptr_t address, size_t size) { + /* Only allow invoking the svc on development hardware. */ + R_UNLESS(KTargetSystem::IsDebugMode(), svc::ResultNotImplemented()); + /* Validate address / size. */ R_UNLESS(size > 0, svc::ResultInvalidSize()); R_UNLESS((address < address + size), svc::ResultInvalidCurrentMemory());