References:
Pointer Capture: A pointer value is captured if the function makes a copy of any part of the pointer that outlives the call.
Pinter Escape: A pointer value escapes if it is accessible from outside the current function or thread. The latter case is sometimes considered separate and called thread-escape.
Capture and Escape are not opposites: Informally, escaping is concerned with the contents of the pointer, while capturing is concerned with the pointer itself 1.
Examples:
int f(void* p) {
return ((unsigned long)p & 15) == 0;
}
Function f
returns whether a given pointer p
is aligned on a 16-byte boundary. This function captures pointer p
but does not cause its value to escape.
“The goal of knowing whether a pointer is captured or escaped, is providing the compiler to correctly change the address or content respectively of a pointer”.
If you could revise
the fundmental principles of
computer system design
to improve security...
... what would you change?