mprotect(2) clears the flag for whole page which causes program
crash.
Robert N. M. Watson
rwatson at freebsd.org
Thu Nov 19 11:42:35 UTC 2009
On 19 Nov 2009, at 10:57, Sharad Chandra wrote:
> Thanks everyone. mmap(2) worked and program did not crash. Only problem with
> it I use only fraction of allocated memory (each request alocate minimum of
> one page and my request is in hundreds), rest is waste of it so no one else
> will get this memory to use. And if a process runs as daemon and makes many
> request, It can hold a lot of it. Just a question floated in mind.
One of the defining properties of pages is that they are the granularity at which access protections are controlled in hardware, so your choices are a minimum of one page per object, or having multiple objects that share the same protection properties. However, it could be that you could accomplish whatever your goals may be using techniques other than paging; for example, using ptrace(2) to instrument individual accesses, binary rewriting, a virtual machine, source code instrumentation, or other methods along those lines that have been used for debugging and security over the years.
Robert
More information about the freebsd-hackers
mailing list