News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

write protected page table entry

Started by vandelay, January 14, 2006, 12:44:52 AM

Previous topic - Next topic

vandelay

I'm trying to find something about this in the Intel manual, but I can't find the relevant section.

Are you allowed to have a write protected page table entry? And if you are, what happens when the PTE needs to be updated?

Regarding page-level protection, the manual says:

With page-level protection (as with segment-level protection) each memory reference is
checked to verify that protection checks are satisfied. All checks are made before the memory
cycle is started, and any violation prevents the cycle from starting and results in a page-fault
exception being generated.

Does this also apply to this specific situation?

Tedd

Write protection is ignored at Ring-0 (system level) which means that the system can write to it as it pleases. And it should be protected from user level access in any case.
Which also means that there will be no exception for accessing a protected page by the system -- unless that page isn't in (virtual) memory, but this isn't quite the same case.
No snowflake in an avalanche feels responsible.

vandelay

But isn't it possible to write protect pages even from code in supervisor mode? Aren't supervisor level pages are write protected from supervisor level code, and if CR0.WP is set, aren't all pages write protected from supervisor level code?

Tedd

As I remember - no.
You assume that supervisor level code can be trusted (you need to trust someone to modify the pages/tables).
I think the idea is that since supervisor is trusted, needing to unset and then set the flags each time you want to modify a page is too much delay.
Of course it might be nice to protect yourself from shooting your feet, but I think that's the idea behind ring-1 and 2
No snowflake in an avalanche feels responsible.

vandelay

Here's what I can find on it in the Intel manual - it looks like it's sort of a new thing:

The P6 family, Pentium, and Intel486 processors allow user-mode pages to be write-protected
against supervisor-mode access. Setting the WP flag in register CR0 to 1 enables supervisor-mode
sensitivity to user-mode, write protected pages. Supervisor pages which are read-only are
not writable from any privilege level, regardless of WP setting.