Reputation: 1573
And I'm really looking for any solution to this - my goal is to set an area smaller than the system's page size to PROT_READ, PROT_WRITE, PROT_EXEC or PROT_NONE. Is this possible? It seems mprotect just protects a multiple of the page size...
If it's not possible, what's the reason for this design choice?
Upvotes: 3
Views: 1854
Reputation: 28839
This is generally not possible.
The protection attribute is set in the page tables of the CPU, so this is a CPU design decision.
If you just need this sub-page protection for one particular area, I believe there are ways to set up a hardware memory access break-point, which will trigger if that area is accessed.
Upvotes: 5