mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-10-30 07:29:02 -05:00 
			
		
		
		
	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.
This commit is contained in:
		| @@ -350,6 +350,10 @@ static ResultCode ArbitrateLock(Handle holding_thread_handle, VAddr mutex_addr, | |||||||
|         return ERR_INVALID_ADDRESS_STATE; |         return ERR_INVALID_ADDRESS_STATE; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     if (!Common::IsWordAligned(mutex_addr)) { | ||||||
|  |         return ERR_INVALID_ADDRESS; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     auto& handle_table = Core::System::GetInstance().Kernel().HandleTable(); |     auto& handle_table = Core::System::GetInstance().Kernel().HandleTable(); | ||||||
|     return Mutex::TryAcquire(handle_table, mutex_addr, holding_thread_handle, |     return Mutex::TryAcquire(handle_table, mutex_addr, holding_thread_handle, | ||||||
|                              requesting_thread_handle); |                              requesting_thread_handle); | ||||||
| @@ -363,6 +367,10 @@ static ResultCode ArbitrateUnlock(VAddr mutex_addr) { | |||||||
|         return ERR_INVALID_ADDRESS_STATE; |         return ERR_INVALID_ADDRESS_STATE; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     if (!Common::IsWordAligned(mutex_addr)) { | ||||||
|  |         return ERR_INVALID_ADDRESS; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     return Mutex::Release(mutex_addr); |     return Mutex::Release(mutex_addr); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Lioncash
					Lioncash