Only check user pages rather than all bytes in-between, for known-size pointers

This commit is contained in:
2024-11-12 15:48:22 +00:00
parent cf4bf90cbb
commit 59e7a64f8e

View File

@@ -421,7 +421,8 @@ validate_user_pointer (const void *ptr, size_t size, bool check_write)
void *last = ptr + size - 1;
if (!is_user_vaddr (last))
thread_exit ();
for (; ptr <= last; ptr++)
ptr = pg_round_down (ptr);
while (ptr <= last)
{
int result;
/* Check read access to pointer. */
@@ -430,6 +431,7 @@ validate_user_pointer (const void *ptr, size_t size, bool check_write)
/* Check write access to pointer (if required). */
if (check_write && !put_user (ptr, result))
thread_exit ();
ptr += PGSIZE;
}
}