kernel: Properly check memory bounds while touching user memory
Before this patch, one byte of each page was being accessed without checking the page's permissions.
This commit is contained in:
parent
10c892d606
commit
097353e779
@ -562,7 +562,7 @@ namespace MemoryManager
|
|||||||
while (size--)
|
while (size--)
|
||||||
{
|
{
|
||||||
// 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) == 0)
|
||||||
{
|
{
|
||||||
if (!validate_page_access(user_ptr, MMU::ReadWrite | MMU::User)) return false;
|
if (!validate_page_access(user_ptr, MMU::ReadWrite | MMU::User)) return false;
|
||||||
}
|
}
|
||||||
@ -590,7 +590,7 @@ namespace MemoryManager
|
|||||||
while (size--)
|
while (size--)
|
||||||
{
|
{
|
||||||
// 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) == 0)
|
||||||
{
|
{
|
||||||
if (!validate_page_access(user_ptr, MMU::User)) return false;
|
if (!validate_page_access(user_ptr, MMU::User)) return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user