kmm_map.c: Fix user page mapping

User pages are mapped from the currently active address environment. If
the process is running on a borrowed address environment, then the
mapping should be created from there.

This happens during (new) process creation only.
This commit is contained in:
Ville Juven
2023-10-03 12:53:32 +03:00
committed by Petro Karashchenko
parent b2f9926a1b
commit a444435f8b
+2 -2
View File
@@ -82,7 +82,7 @@ static int get_user_pages(FAR void **pages, size_t npages, uintptr_t vaddr)
for (i = 0; i < npages; i++, vaddr += MM_PGSIZE)
{
page = up_addrenv_find_page(&tcb->addrenv_own->addrenv, vaddr);
page = up_addrenv_find_page(&tcb->addrenv_curr->addrenv, vaddr);
if (!page)
{
/* Something went wrong, get out */
@@ -182,7 +182,7 @@ static FAR void *map_single_user_page(uintptr_t vaddr)
/* Find the page associated with this virtual address */
page = up_addrenv_find_page(&tcb->addrenv_own->addrenv, vaddr);
page = up_addrenv_find_page(&tcb->addrenv_curr->addrenv, vaddr);
if (!page)
{
return NULL;