Skip to content
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

PageFault error code now reports page presence correctly #1022

Merged
merged 3 commits into from
Apr 23, 2024

Conversation

Bananymous
Copy link
Contributor

If page directory was present and ring3 access or write protection violation caused page fault on page directory level, page presence was not checked and it was assumed to be present.

This PR adds this check to correctly report present bit in page fault error codes.

I found this bug as my OS uses the present bit in error code of page fault as the initial requirement for demand paging.

This is my first time writing rust, so please tell me if something should be done differently.

@copy
Copy link
Owner

copy commented Apr 20, 2024

Interesting find, this is a pretty serious bug.

This is my first time writing rust, so please tell me if something should be done differently.

I think you could avoid the extra function by moving the write/user checks down and combining them with the page table checks. I'll leave a suggestion in the review.

I'll try to write some tests for this.

If page directory was present and ring3 access or write protect
caused page fault on page directory level, page precense was not
checked.

This patch adds this check and correctly reports page fault error.
@Bananymous
Copy link
Contributor Author

Done.

src/rust/cpu/cpu.rs Outdated Show resolved Hide resolved
@copy copy merged commit 9a9d6f3 into copy:master Apr 23, 2024
3 checks passed
@copy
Copy link
Owner

copy commented Apr 23, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants