This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: malloc using mprotect


Hello,

> What's the exact reason for using mmap(..., PROT_NONE, ...) first and then
> mprotect (..., PROT_READ|PROT_WRITE) chunk by chunk instead of

It's actually happening in rather bis chunks, _not_ individually for
every malloc()ed chunk larger than a page.

> mmap(..., PROT_READ|PROT_WRITE, ...) first and nothing afterwards?
> Is it primarily to catch bogus programs?

No, not primarily.

> Or is it primarily so that the whole heap does not count immediately into
> rlimits, but slowly as malloc areas are requested?

Yes, that is one of the main reasons.  After all, the heaps are quite
huge (or at least were quite huge in 1996 :).

> If we explain it to Linus, I guess he could accept mprotect(2) patches to do
> some merging in the common case.

What exactly is the problem?

Regards,
Wolfram.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]