

What is memory safety? - munin
http://www.pl-enthusiast.net/2014/07/21/memory-safety/

======
lmkg
This definition of memory safety reminds me of a story of writing a C compiler
for LISP machines. As I recall, C pointers were represented in LISP as a tuple
of a reference to a buffer, and an index into that buffer. In other words, the
exact same solution as used in this article: All pointers carry with them
(explicitly, in this case) information about which "derived" pointers are
legal.

~~~
xenophonf
Check out [http://arcanesentiment.blogspot.com/2012/05/pointer-
arithmet...](http://arcanesentiment.blogspot.com/2012/05/pointer-arithmetic-
can-be-safe.html), which describes Zeta-C's handling of pointers (Zeta-C being
a C compiler for Lisp machines).

And as a bonus, there's a link to the Zeta-C source code!

------
cousin_it
Good work! The "pointers as capabilities" idea makes it much clearer to me
what "memory safety" means. Can we have a similar article about "type safety"?
I think many people would benefit from knowing the exact relationship between
type safety and memory safety, and whether one is a subset of the other.

------
zvrba
> We should think of a pointer as consisting of logically three elements
> (p,b,e): the legal region is defined by the base b and bounds (or extent) e,
> and the pointer itself is p.

Everything old is new again. Look up how segmentation works on x86 in 32-bit
mode (initially introduced as "protected mode" on 80286).

~~~
renox
Bah, this was dropped on x86-64, so it's not very interesting..

