1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-12-23 02:42:09 +00:00

kern: use fix usage of incorrect page table for UserBuffer ipc

This commit is contained in:
Michael Scire 2021-03-13 15:08:38 -08:00
parent deb4aece9a
commit 021d4c88fa

View file

@ -771,6 +771,9 @@ namespace ams::kern {
/* NOTE: Session is used only for debugging, and so may go unused. */ /* NOTE: Session is used only for debugging, and so may go unused. */
MESOSPHERE_UNUSED(session); MESOSPHERE_UNUSED(session);
/* NOTE: Source page table is not used, and so may go unused. */
MESOSPHERE_UNUSED(src_page_table);
/* Determine the message buffers. */ /* Determine the message buffers. */
u32 *dst_msg_ptr, *src_msg_ptr; u32 *dst_msg_ptr, *src_msg_ptr;
bool dst_user, src_user; 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 the fast part of the copy didn't get everything, perform the slow part of the copy. */
if (fast_size < raw_size) { 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, KMemoryState_FlagReferenceCounted, KMemoryState_FlagReferenceCounted,
dst_perm, dst_perm,
KMemoryAttribute_Uncached, KMemoryAttribute_None, KMemoryAttribute_Uncached, KMemoryAttribute_None,
@ -921,7 +924,7 @@ namespace ams::kern {
constexpr KMemoryPermission DestinationPermission = static_cast<KMemoryPermission>(KMemoryPermission_NotMapped | KMemoryPermission_KernelReadWrite); constexpr KMemoryPermission DestinationPermission = static_cast<KMemoryPermission>(KMemoryPermission_NotMapped | KMemoryPermission_KernelReadWrite);
/* Copy the memory. */ /* 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, KMemoryState_FlagReferenceCounted, KMemoryState_FlagReferenceCounted,
DestinationPermission, DestinationPermission,
KMemoryAttribute_Uncached, KMemoryAttribute_None, KMemoryAttribute_Uncached, KMemoryAttribute_None,