Re: Understanding Linux addr space, malloc, and heap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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!"

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. It might return all memory at some random 16-byte offset into a page. If you make malloc'ed memory read only, you might make malloc()-internal data read-only too and cause malloc() to crash. YOU CANNOT RELY ON THIS TO WORK!!! Is that sufficiently clear? It may work for you, and it may not, but when it breaks, don't whine on the LKML.

I have implemented simple sandboxing this way. For my dissertation I implemented a DSM by mprotect'g malloc'd memory. This system worked for >6 on several version of Linux and SunOS. I actually have a better track record for this technique than for some things that are within the specifications.

If it works for you, good luck, but don't try to tell us that it's wrong when it breaks in a very documented way.

Cheers,
Kyle Moffett

--
Premature optimization is the root of all evil in programming
  -- C.A.R. Hoare



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux