1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-26 22:02:15 +00:00

kern: fix bugs in Receive/Exchange ipc buffers

This commit is contained in:
Michael Scire 2020-07-13 10:02:01 -07:00
parent 095fc6b996
commit 84d8634938
2 changed files with 2 additions and 2 deletions

View file

@ -400,7 +400,7 @@ namespace ams::kern {
/* If this is our first lock, update our permissions. */ /* If this is our first lock, update our permissions. */
if (new_lock_count == 1) { if (new_lock_count == 1) {
MESOSPHERE_ASSERT(this->original_perm == KMemoryPermission_None); MESOSPHERE_ASSERT(this->original_perm == KMemoryPermission_None);
MESOSPHERE_ASSERT((this->perm | new_perm) == this->perm); MESOSPHERE_ASSERT((this->perm | new_perm | KMemoryPermission_NotMapped) == (this->perm | KMemoryPermission_NotMapped));
MESOSPHERE_ASSERT((this->perm & KMemoryPermission_UserExecute) != KMemoryPermission_UserExecute || (new_perm == KMemoryPermission_UserRead)); MESOSPHERE_ASSERT((this->perm & KMemoryPermission_UserExecute) != KMemoryPermission_UserExecute || (new_perm == KMemoryPermission_UserRead));
this->original_perm = this->perm; this->original_perm = this->perm;
this->perm = static_cast<KMemoryPermission>((new_perm & KMemoryPermission_IpcLockChangeMask) | (this->original_perm & ~KMemoryPermission_IpcLockChangeMask)); this->perm = static_cast<KMemoryPermission>((new_perm & KMemoryPermission_IpcLockChangeMask) | (this->original_perm & ~KMemoryPermission_IpcLockChangeMask));

View file

@ -2169,7 +2169,7 @@ namespace ams::kern {
std::memcpy(GetVoidPointer(end_partial_page), GetVoidPointer(GetHeapVirtualAddress(cur_block_addr)), copy_size); std::memcpy(GetVoidPointer(end_partial_page), GetVoidPointer(GetHeapVirtualAddress(cur_block_addr)), copy_size);
std::memset(GetVoidPointer(end_partial_page + copy_size), fill_val, PageSize - copy_size); std::memset(GetVoidPointer(end_partial_page + copy_size), fill_val, PageSize - copy_size);
} else { } else {
std::memset(GetVoidPointer(start_partial_page), fill_val, PageSize); std::memset(GetVoidPointer(end_partial_page), fill_val, PageSize);
} }
/* Map the page. */ /* Map the page. */