Skip to content

Issue in copy_string_from_task function #2

@sahaamit

Description

@sahaamit

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions