SafeStack Merged Into LLVM To Protect Against Stack Buffer Overflow Attacks
Written by Michael Larabel in LLVM on 28 June 2015 at 09:25 AM EDT. 3 Comments
SafeStack was merged into LLVM this month as a new form of protection against stack-based memory corruption errors. The SafeStack pass for LLVM adds in protection against stack-based buffer overflows without causing any significant performance penalty.

The commit explains, "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." It's great to see them validate against the Phoronix Test Suite; we also continue to benchmark LLVM/Clang daily over on

The SafeStack commit explains the work. There's also the new documentation, "SafeStack is an instrumentation pass that protects programs against attacks based on stack buffer overflows, without introducing any measurable performance overhead. It works by separating the program stack into two distinct regions: the safe stack and the unsafe stack. The safe stack stores return addresses, register spills, and local variables that are always accessed in a safe way, while the unsafe stack stores everything else. This separation ensures that buffer overflows on the unsafe stack cannot be used to overwrite anything on the safe stack."

SafeStack will be part of LLVM 3.7 when released in late August.
Related News
About The Author
Author picture

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter or contacted via

Popular News This Week