ash
ash

Reputation: 51

Linux Memory Management

Is there any way i can mark a page execute only with no read permissions ? (i.e able to execute instructions on that page without having read permissions of that page which is executable.)

My final goal is to make a page that i can execute but no other process should be able to make any data access to that page ..

Upvotes: 5

Views: 279

Answers (1)

thkala
thkala

Reputation: 86333

This is one of the things that is kernel and hardware-dependent, as mentioned in the mprotect() manual page:

Whether PROT_EXEC has any effect different from PROT_READ is architecture and kernel version dependent.

On recent Linux/x86 kernels, those flags are definitely discrete if your CPU supports the NX-bit. On the other x86 CPUs, it depends on whether your kernel has support for Exec-Shield or another similar NX-bit emulation.

Upvotes: 4

Related Questions