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

Writes should only be allowed on already dirty translations. #3

Open
snue opened this issue Sep 7, 2021 · 1 comment
Open

Writes should only be allowed on already dirty translations. #3

snue opened this issue Sep 7, 2021 · 1 comment

Comments

@snue
Copy link

snue commented Sep 7, 2021

The code in https://github.com/blitz/vmmu/blob/master/libvmmu/src/tlb_entry.cpp#L20 should reject writes to translations that are not marked dirty.

The current implementation emulates the hardware behavior only, which does not specifically care for the dirty bit checks.

Currently, a translation obtained for a read will transparently allow later writes without causing a page walk (and thus not marking the page structures dirty). This is a bug.

Something along these lines after the mode == paging_mode::PHYS check should be sufficient:

        // Writes are only allowed on already dirty translations.
        if (op.is_write() and not attr().is_d())
            return false;
@snue
Copy link
Author

snue commented Sep 20, 2021

Note that this change would break the current page walk logic, which does the allows() check before marking the entry dirty: https://github.com/blitz/vmmu/blob/master/libvmmu/src/pt_walk.cpp#L132-L133

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

No branches or pull requests

1 participant