softboundcets-34 icon indicating copy to clipboard operation
softboundcets-34 copied to clipboard

Porting to a newer version of LLVM

Open obraunsdorf opened this issue 5 years ago • 1 comments

Hi, what do you think would be the main challenge for porting Softbound/CETS to a more current version of LLVM (8.0 or higher)? Is it feasible? Do you know someone who tried this already?

Thanks in advance :)

obraunsdorf avatar Oct 13 '19 08:10 obraunsdorf

I think getting a working prototype for LLVM-9 is easy. The main challenge will be reducing overheads to less than 2X for both spatial and temporal memory safety.

Here are the main challenges:

  1. Inlining all the checks for performance. I was relying on LTO and LLVM-LD to inline all the checks. It needs to be rethought for LLVM-9.

  2. Metadata propagation for arguments and returns. I used a shadow stack to pass arguments and returns. It adds performance overheads with small functions. It also can introduce issues when compilers optimize function arguments. Here is an example in the paper: https://www.cs.rutgers.edu/~santosh.nagarakatte/papers/plas2017.pdf

  3. Handling first class vectors and structures.

  4. Handling global initializers and external libraries. Ideally you would recompile everything with SoftBoundCETS pass, then handling libraries is easy. Otherwise, you may want to write wrappers. In contrast to sanitizers, you need to maintain metadata with each pointers and hence the compiler instrumentation is a bit more involved.

  5. Use linear addressing for accessing metadata similar to other sanitizers.

santoshn avatar Oct 15 '19 01:10 santoshn