From 4b5ae8dbaa267d0f269ded8e621b43065fb5ae20 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 18 Oct 2018 13:01:26 -0400 Subject: svc: Check for word alignment of addresses within svcArbitrateLock/svcArbitrateUnlock The kernel itself checks whether or not the provided addresses are word aligned before continuing, so we should be doing the same. --- src/core/hle/kernel/svc.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index b0bdd822e..d3c9d50b5 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -350,6 +350,10 @@ static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, return ERR_INVALID_ADDRESS_STATE; } + if (!Common::IsWordAligned(mutex_addr)) { + return ERR_INVALID_ADDRESS; + } + auto& handle_table = Core::System::GetInstance().Kernel().HandleTable(); return Mutex::TryAcquire(handle_table, mutex_addr, holding_thread_handle, requesting_thread_handle); @@ -363,6 +367,10 @@ static ResultCode ArbitrateUnlock(VAddr mutex_addr) { return ERR_INVALID_ADDRESS_STATE; } + if (!Common::IsWordAligned(mutex_addr)) { + return ERR_INVALID_ADDRESS; + } + return Mutex::Release(mutex_addr); } -- cgit v1.2.3