|
paging_map(task_desc, phys_tmp, phys_tmp, PAGING_IS_WRITEABLE | PAGING_IS_PRESENT | PAGING_ACCESS_FROM_ALL); |
|
|
|
// Switch to the user pages |
|
task_page_task(task); |
|
// we are now on the page tables of the task |
|
strncpy(tmp, virtual, max); |
Here, it is mapping virtual address phys_tmp in task's page table, not tmp. Hence, virtual address phys_tmp is only accessible once it switches to page table of user task. Ideally, it should copy from user text from virtual to phys_tmp instead of tmp. I think It won't cause any issue if kzalloc() returns linear address for tmp variable where virtual and physical address is same. So line 213 should be strncpy(phys_tmp, virtual, max); to handle the case.
PeachOS64BitCourse/PeachOS64Bit/src/task/task.c
Lines 208 to 213 in 87c13b2
Here, it is mapping virtual address
phys_tmpin task's page table, nottmp. Hence, virtual addressphys_tmpis only accessible once it switches to page table of user task. Ideally, it should copy from user text fromvirtualtophys_tmpinstead oftmp. I think It won't cause any issue if kzalloc() returns linear address fortmpvariable where virtual and physical address is same. So line 213 should bestrncpy(phys_tmp, virtual, max);to handle the case.