From 84d8634938f2929271ff94a5cb47771846523c02 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Mon, 13 Jul 2020 10:02:01 -0700 Subject: [PATCH] kern: fix bugs in Receive/Exchange ipc buffers --- .../libmesosphere/include/mesosphere/kern_k_memory_block.hpp | 2 +- libraries/libmesosphere/source/kern_k_page_table_base.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_memory_block.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_memory_block.hpp index d77c97df0..19439ddd1 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_memory_block.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_memory_block.hpp @@ -400,7 +400,7 @@ namespace ams::kern { /* If this is our first lock, update our permissions. */ if (new_lock_count == 1) { 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)); this->original_perm = this->perm; this->perm = static_cast((new_perm & KMemoryPermission_IpcLockChangeMask) | (this->original_perm & ~KMemoryPermission_IpcLockChangeMask)); diff --git a/libraries/libmesosphere/source/kern_k_page_table_base.cpp b/libraries/libmesosphere/source/kern_k_page_table_base.cpp index 48c68f130..3b59727a7 100644 --- a/libraries/libmesosphere/source/kern_k_page_table_base.cpp +++ b/libraries/libmesosphere/source/kern_k_page_table_base.cpp @@ -2169,7 +2169,7 @@ namespace ams::kern { 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); } else { - std::memset(GetVoidPointer(start_partial_page), fill_val, PageSize); + std::memset(GetVoidPointer(end_partial_page), fill_val, PageSize); } /* Map the page. */