Messages in this thread | | | From | Bodo Eggert <> | Subject | Re: Understanding Linux addr space, malloc, and heap | Date | Sun, 23 Oct 2005 12:41:35 +0200 |
| |
Kyle Moffett <mrmacman_g4@mac.com> wrote: > On Oct 21, 2005, at 12:24:50, Vincent W. Freeh wrote:
>> I guess I live in a different world. I do lots of things I'm not >> "supposed" to do. > > So why are you complaining that it doesn't work? "Doctor, it hurts > when I use my toes to hold a nail as I hammer it in!" "Well don't do > that then!"
I'm not supposed to run linux on i386, ask Bill. Why do I do it then?
>> Moreover, it is very sensible and usable to mprotect malloc pages. > > DANGER! DANGER WILL ROBINSON! DANGER! malloc() is *NOT* guaranteed > or even theoretically implemented to return pages.
If you allocate a block of 2*PAGESIZE-1 bytes, *any* allocation method is *guaranteed* return at least one complete page. (BTW: The example from the manpage is wrong since it does only make sure the starting address is on the page, but not that the end of the protected memory is within the allocated area. Whom should I contact?)
But even if Vincend makes the next malloc/free/whatever to be fubar, or if he made the world explode, mprotect is still required to report an error if the requested action failed. If it doesn't do that for mprotecting _any_ range, no matter how strange it may be, it is broken. -- Ich danke GMX dafür, die Verwendung meiner Adressen mittels per SPF verbreiteten Lügen zu sabotieren. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |