Reference1
Earlier work:
In this work,
A table of all known valid storage objects:
All pointer arithmetic and pointer use are checked.
(void *)-2
).Example: pointers to objects.
Permitted operations for pointers above:
Object/pinter tracking: track object when created/deleted:
stack objects:
alloca
function.De-register: constructor/destructor mechanism. The following compilation happens:
int sum (int n, int *a){
int i, s = 0;
for (i = 0; i < n; ++i)
s += a[i];
return s;
}
Compiled to
int sum (int n, int *a){
/* bounds push function enters a function context. A
* matching call to bounds pop function will
* delete parameters.
*/
__bounds_push_function ("sum");
__bounds_add_parameter_object (&n, sizeof (int), ...);
__bounds_add_parameter_object (&a, sizeof (int*), ...);
/* Extra scope created around the function. GCC will
* call bounds pop function when leaving this
* scope.
*/
{
/* Declare stack objects, and use GCC's destructor
* mechanism to ensure __bounds_delete_stack_object is
* called for each variable however we leave scope
* (even if we leave with goto).
*/
int i;
__bounds_add_stack_object (&i, sizeof (int), ...);
int s = u;
__bounds_add_stack_object (&s, sizeof (int), ...);
for (i = 0; i < n; ++i)
s += *(int*)__bounds_check_array_reference(a, i, sizeof (int), ...);
__bounds_delete_stack_object(&s);
__bounds_delete_stack_object(&i);
}
end;
__bounds_pop_function("sum"); /* Delete a, n. */
return s;
}
goto example. Figure 4: goto label1
creates b
and goto label2
destroys b
.
Corner Cases:
Splay trees to look up pointers:
Jones-Kelly inserts the following checks (ignoring any later optimizaiton) on each arithmetic operation involving a pointer value:
If you could revise
the fundmental principles of
computer system design
to improve security...
... what would you change?