-
Notifications
You must be signed in to change notification settings - Fork 37
Update implementation of UserPtr #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
It seems that using |
However using |
Is there any particular reason we're not handling page fault from kernel? https://github.com/oscomp/starry-next/blob/main/src/mm.rs#L196 |
We think that memory access operation from kernel mode which cause page fault will be an illegal operation. If user hope to access the lazy area through syscall like |
It is aim to reduce overhead from trap causing by page fault. |
So @AsakuraMizu 's opinion is right. When we check whether region is valid, the flag of the page table is not necessarily equal to the area flag. It can be solved by check whether the area belong to |
I checked Linux kernel and they have
So basically, Linux is tolerating page fault in kernel space under this userspace accessing scenario. I don't think we should treat this specially (like pre-allocate all the pages). |
Give me some time to search more information, sorry! |
Perhaps it would be more convenient to put the processing of access to the lazy area in the page fault processing, avoiding special judgments for all operations that need to access user addresses. |
Then please add processing for page fault for kernel mode at https://github.com/oscomp/starry-next/blob/main/src/mm.rs#L196 in this PR @Mivik |
Fix the CI test |
* feat: update implementation of UserPtr * style: remove unused code * feat(ptr): use check_page in check_cstr * feat(ptr): force allocate pages on get ptr * fix: upload mm.rs * fix: disable preemption inside access_user_memory * feat(ptr): add get_as_null_terminated to replace get_as_cstr * feat(ptr): add nullable helper * style(ptr): refactor implementation
Use
AddrSpace::check_region_access
to implementUserPtr
.