Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ..

like image 322
ash Avatar asked Oct 11 '22 06:10

ash


1 Answers

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.

like image 56
thkala Avatar answered Jan 01 '23 11:01

thkala