From 021d4c88fabdce852750971bedb0adc74531b08f Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sat, 13 Mar 2021 15:08:38 -0800 Subject: [PATCH] kern: use fix usage of incorrect page table for UserBuffer ipc --- libraries/libmesosphere/source/kern_k_server_session.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/libmesosphere/source/kern_k_server_session.cpp b/libraries/libmesosphere/source/kern_k_server_session.cpp index d2d67cbab..e49f78ebb 100644 --- a/libraries/libmesosphere/source/kern_k_server_session.cpp +++ b/libraries/libmesosphere/source/kern_k_server_session.cpp @@ -771,6 +771,9 @@ namespace ams::kern { /* NOTE: Session is used only for debugging, and so may go unused. */ MESOSPHERE_UNUSED(session); + /* NOTE: Source page table is not used, and so may go unused. */ + MESOSPHERE_UNUSED(src_page_table); + /* Determine the message buffers. */ u32 *dst_msg_ptr, *src_msg_ptr; bool dst_user, src_user; @@ -907,7 +910,7 @@ namespace ams::kern { /* If the fast part of the copy didn't get everything, perform the slow part of the copy. */ if (fast_size < raw_size) { - R_TRY(src_page_table.CopyMemoryFromHeapToHeap(dst_page_table, dst_message_buffer + max_fast_size, raw_size - fast_size, + R_TRY(dst_page_table.CopyMemoryFromHeapToHeap(dst_page_table, dst_message_buffer + max_fast_size, raw_size - fast_size, KMemoryState_FlagReferenceCounted, KMemoryState_FlagReferenceCounted, dst_perm, KMemoryAttribute_Uncached, KMemoryAttribute_None, @@ -921,7 +924,7 @@ namespace ams::kern { constexpr KMemoryPermission DestinationPermission = static_cast(KMemoryPermission_NotMapped | KMemoryPermission_KernelReadWrite); /* Copy the memory. */ - R_TRY(src_page_table.CopyMemoryFromUserToLinear(dst_message_buffer + offset_words, raw_size, + R_TRY(dst_page_table.CopyMemoryFromUserToLinear(dst_message_buffer + offset_words, raw_size, KMemoryState_FlagReferenceCounted, KMemoryState_FlagReferenceCounted, DestinationPermission, KMemoryAttribute_Uncached, KMemoryAttribute_None,