C - Is mprotect possible for something less than a page

And I'm really looking for any solution for this - my goal is to set the area to be smaller than the system page size, PROT_READ, PROT_WRITE, PROT_EXEC, or PROT_NONE. Is it possible? It seems mprotect is just protecting a multiple of the page size ...

If this is not possible, what is the reason for choosing this design?

+3


source to share


1 answer


It's impossible at all.

The security attribute is set in the CPU page tables, so this is a CPU design solution.



If you need this subpage protection for one specific area, I believe there are ways to configure a hardware memory access point that will fire if that area is available.

+5


source







All Articles