llvm-6502/test
Peter Collingbourne 7ffec838a2 Protection against stack-based memory corruption errors using SafeStack
This patch adds the safe stack instrumentation pass to LLVM, which separates
the program stack into a safe stack, which stores return addresses, register
spills, and local variables that are statically verified to be accessed
in a safe way, and the unsafe stack, which stores everything else. Such
separation makes it much harder for an attacker to corrupt objects on the
safe stack, including function pointers stored in spilled registers and
return addresses. You can find more information about the safe stack, as
well as other parts of or control-flow hijack protection technique in our
OSDI paper on code-pointer integrity (http://dslab.epfl.ch/pubs/cpi.pdf)
and our project website (http://levee.epfl.ch).

The overhead of our implementation of the safe stack is very close to zero
(0.01% on the Phoronix benchmarks). This is lower than the overhead of
stack cookies, which are supported by LLVM and are commonly used today,
yet the security guarantees of the safe stack are strictly stronger than
stack cookies. In some cases, the safe stack improves performance due to
better cache locality.

Our current implementation of the safe stack is stable and robust, we
used it to recompile multiple projects on Linux including Chromium, and
we also recompiled the entire FreeBSD user-space system and more than 100
packages. We ran unit tests on the FreeBSD system and many of the packages
and observed no errors caused by the safe stack. The safe stack is also fully
binary compatible with non-instrumented code and can be applied to parts of
a program selectively.

This patch is our implementation of the safe stack on top of LLVM. The
patches make the following changes:

- Add the safestack function attribute, similar to the ssp, sspstrong and
  sspreq attributes.

- Add the SafeStack instrumentation pass that applies the safe stack to all
  functions that have the safestack attribute. This pass moves all unsafe local
  variables to the unsafe stack with a separate stack pointer, whereas all
  safe variables remain on the regular stack that is managed by LLVM as usual.

- Invoke the pass as the last stage before code generation (at the same time
  the existing cookie-based stack protector pass is invoked).

- Add unit tests for the safe stack.

Original patch by Volodymyr Kuznetsov and others at the Dependable Systems
Lab at EPFL; updates and upstreaming by myself.

Differential Revision: http://reviews.llvm.org/D6094

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239761 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-15 21:07:11 +00:00
..
Analysis [ValueTracking] do not overwrite analysis results already computed 2015-06-15 05:46:29 +00:00
Assembler Make the test introduced in r239015 more targeted. 2015-06-04 07:21:42 +00:00
Bindings
Bitcode [BitcodeReader] Diagnose type mismatches with aliases 2015-06-03 01:30:13 +00:00
BugPoint
CodeGen MIR Serialization: Connect the machine function analysis pass to the MIR parser. 2015-06-15 20:30:22 +00:00
DebugInfo Revert "[DWARF] Fix a few corner cases in expression emission" 2015-06-09 18:01:51 +00:00
ExecutionEngine [Mips64][mcjit] Add R_MIPS_PC32 relocation 2015-06-08 14:10:23 +00:00
Feature
FileCheck
Instrumentation [asan] Prevent __attribute__((annotate)) triggering errors on Darwin 2015-06-09 00:58:08 +00:00
Integer
JitListener
Linker Changed renaming of local symbols by inserting a dot vefore the numeric suffix. 2015-05-12 16:47:30 +00:00
LTO
MC Add support for parsing the XOR operator in Intel syntax inline assembly. 2015-06-14 12:59:45 +00:00
Object Object: Prepend __imp_ when mangling a dllimport symbol in IRObjectFile. 2015-06-11 21:42:18 +00:00
Other Let llc and opt override "-target-cpu" and "-target-features" via command line 2015-05-06 23:54:14 +00:00
SymbolRewriter
TableGen Use std::bitset for SubtargetFeatures. 2015-05-26 10:47:10 +00:00
tools gold-plugin: save the .o when given -save-temps. 2015-06-15 13:36:27 +00:00
Transforms Protection against stack-based memory corruption errors using SafeStack 2015-06-15 21:07:11 +00:00
Unit
Verifier [Verifier] Assert gc_relocate always return a pointer type 2015-05-18 19:50:14 +00:00
YAMLParser YAML: Implement block scalar parsing. 2015-05-13 23:10:51 +00:00
.clang-format
CMakeLists.txt LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00
lit.cfg LibDriver, llvm-lib: introduce. 2015-06-09 21:50:22 +00:00
lit.site.cfg.in
Makefile
Makefile.tests
TestRunner.sh