Kernel: Keep the user pointer const through copy_from_user()
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-01-11 19:26:53 +01:00
parent 6e4cd6300d
commit 79a5b98d65
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -466,7 +466,7 @@ namespace MemoryManager
// Userspace pointer not aligned on page boundary // Userspace pointer not aligned on page boundary
if (user_ptr != user_page) if (user_ptr != user_page)
{ {
if (!validate_user_writable_page(user_page)) return false; if (!validate_user_readable_page(user_page)) return false;
} }
while (size--) while (size--)
@ -474,10 +474,10 @@ namespace MemoryManager
// Crossed a page boundary, gotta check the page tables again before touching any memory!! // Crossed a page boundary, gotta check the page tables again before touching any memory!!
if (user_ptr % ARCH_PAGE_SIZE) if (user_ptr % ARCH_PAGE_SIZE)
{ {
if (!validate_user_writable_page(user_ptr)) return false; if (!validate_user_readable_page(user_ptr)) return false;
} }
*kernel_ptr++ = *(char*)user_ptr; *kernel_ptr++ = *(const char*)user_ptr;
user_ptr++; user_ptr++;
} }