4

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?

user3475234
  • 1,503
  • 3
  • 22
  • 40
  • 1
    You look like you suffer from the [XY problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). If it would help you, could you post the original problem whose solution caused this question to arise? – fuz Oct 04 '14 at 23:25

1 Answers1

6

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.