summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2019-04-05 23:35:06 -0400
committerGravatar GitHub2019-04-05 23:35:06 -0400
commit854ac468b9cdc16296bb78de22b459118706bbde (patch)
treeecf16bdfe7c64015c32bb74a011b111172aa6b8a /src/core/hle/kernel/svc.cpp
parentMerge pull request #2344 from lioncash/result (diff)
parentkernel/svc: Properly sanitize mutex address in WaitProcessWideKeyAtomic (diff)
downloadyuzu-854ac468b9cdc16296bb78de22b459118706bbde.tar.gz
yuzu-854ac468b9cdc16296bb78de22b459118706bbde.tar.xz
yuzu-854ac468b9cdc16296bb78de22b459118706bbde.zip
Merge pull request #2329 from lioncash/sanitize
kernel/svc: Properly sanitize mutex address in WaitProcessWideKeyAtomic
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index ab10db3df..2fd07ab34 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -1339,6 +1339,20 @@ static ResultCode WaitProcessWideKeyAtomic(VAddr mutex_addr, VAddr condition_var
1339 "called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle=0x{:08X}, timeout={}", 1339 "called mutex_addr={:X}, condition_variable_addr={:X}, thread_handle=0x{:08X}, timeout={}",
1340 mutex_addr, condition_variable_addr, thread_handle, nano_seconds); 1340 mutex_addr, condition_variable_addr, thread_handle, nano_seconds);
1341 1341
1342 if (Memory::IsKernelVirtualAddress(mutex_addr)) {
1343 LOG_ERROR(
1344 Kernel_SVC,
1345 "Given mutex address must not be within the kernel address space. address=0x{:016X}",
1346 mutex_addr);
1347 return ERR_INVALID_ADDRESS_STATE;
1348 }
1349
1350 if (!Common::IsWordAligned(mutex_addr)) {
1351 LOG_ERROR(Kernel_SVC, "Given mutex address must be word-aligned. address=0x{:016X}",
1352 mutex_addr);
1353 return ERR_INVALID_ADDRESS;
1354 }
1355
1342 auto* const current_process = Core::System::GetInstance().Kernel().CurrentProcess(); 1356 auto* const current_process = Core::System::GetInstance().Kernel().CurrentProcess();
1343 const auto& handle_table = current_process->GetHandleTable(); 1357 const auto& handle_table = current_process->GetHandleTable();
1344 SharedPtr<Thread> thread = handle_table.Get<Thread>(thread_handle); 1358 SharedPtr<Thread> thread = handle_table.Get<Thread>(thread_handle);