lkml.org 
[lkml]   [2005]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Understanding Linux addr space, malloc, and heap
Date
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 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/

\
 
 \ /
  Last update: 2005-10-22 21:33    [W:0.055 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site