Re: mprotect

Kai Schulte (sp0005@aixrs1.hrz.uni-essen.de)
Tue, 22 Apr 1997 17:05:25 +0200 (MESZ)


On Tue, 22 Apr 1997, John Carter wrote:

> I have just tried the example prog in the mprotect man page. Alas, it
> freaks out with "Invalid Argument".

mprotect can only protect complete pages. It needs a starting address
that is aligned with a page boundary and extends the specified length to
the nearest multiple of the page size. Chances are that malloc will not
return a page-aligned pointer, so it will probably be invalid.

Kai

PS: sorry for being off-topic on linux-gcc. The original posting should
have gone to the kernel list, or rather to the author of the man page...