Reference:
spatial violation detection and prevention.
Object-Based Approaches.
Pointer-Based Approaches.
Comparison of Various Approaches.
Associates base and bound metadata with every pointer.
Disjoint metadata representation avoids memory layout changes and arbitrary casts.
Metadata Propagation with Function Calls.
The SoftBound pass inserts code to:1
To eliminate some obviously redundant checks of the same pointer, our prototype performs a simple intra-procedural dominator-based redundant check elimination. These transformations are all strictly local (intra-procedural) transformations, without any whole program type inference or alias analysis.
Calls to external functions (i.e. any library function that has not been SoftBound transformed) are mapped to wrapper functions.
SoftBound uses standard C functions to implement the code to access the base/bound metadata and to perform the bounds checks. The SoftBound pass invokes these routines by inserting appropriate function calls that are later forcibly inlined by subsequent LLVM passes.
Two implementations: a hash table and a tag-less shadow space.
Hash Table:
Each entry: a three tuple: (tag, base, bound)
Hash function: the double-word address modulo the number of entries in the table.
9 x86 instructions for the lookup.
Shadow Space:
Overhead:
67% full checking;
22% store-only checking.
Compiler: LLVM 2.4
Benchmark:
Comparison:
In general, better than MSCC, worse than CCured.
memcpy()
: infer whether the memory has pointers by looking at the type being copied at the call site – not foolproof;
functin pointers: base=bound=pointer, zero-sized object. can prevent data pointer to function pointer casting; but cannot prevent func to func casting;
no temporal.
If you could revise
the fundmental principles of
computer system design
to improve security...
... what would you change?