Skip to content

Wrap access to the user address space #2

@mingzi47

Description

@mingzi47

Hello,

First of all, thank you and the team for your hard work on developing and maintaining the axsignal crate.

Recently, I have been adding a Copy On Write (COW) mechanism in starry-next. The COW mechanism removes the w (write) flags from the user memory space after fork. When a write is needed in the user space, a page_fault is triggered. According to the reference count of the physical page frame, the w flag is either added back to the physical page frame or a new page is copied.

In this crate, direct access to the user address space, which may trigger a page_fault due to COW. Therefore, some checks should be done before accessing the user space.

https://github.com/Starry-OS/axsignal/blob/main/src/api/thread.rs#L70-L90

In starry-next, the user address space is typically accessed using UserPtr. I believe you should also unify the management of user address space access. Perhaps you could pass the construction of UserPtr as a parameter to the functions that need to access the user address space, enabling safe access to user memory.

Thanks again for your excellent work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions