# Setting page level restrictions



## maheshmylar (Mar 14, 2013)

Hi,

Is there a way in FreeBSD by which we can restrict few contiguous instruction pages to read and write to only to few pages? Basically *I* am trying to restrict dynamically linked libraries to read and write only pages linked due to dynamically linked library and only few pages of the global data in the rest of the process address space.

Can this be done using linker directives or by modifying page level bits within the kernel?

Regards,
Mahesh


----------



## ziyanm (Mar 17, 2013)

Since shared libraries are (by definition) mapped into the process's address space I don't think there's a general way to restrict its memory access. However, shared libraries themselves have no active threads. So how would the library write to the process' address space? Is it via callback? Or are you trying to implement a security feature to prevent shared libraries being hijacked? Some sample (pseudo) code would be useful to demonstrate what you want to do.


----------

