summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/stack-protector.c
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-06-15 21:08:13 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-06-15 21:08:13 +0000
commitc4122c17b473a6f9f2a5940a98939209aaaa3dfc (patch)
treeed886abaabf20a83abfb6ba71e9c7316a6746fab /clang/test/CodeGen/stack-protector.c
parent82437bf7a54221b97b073f8702e0af337b3a1d2b (diff)
downloadbcm5719-llvm-c4122c17b473a6f9f2a5940a98939209aaaa3dfc.tar.gz
bcm5719-llvm-c4122c17b473a6f9f2a5940a98939209aaaa3dfc.zip
Protection against stack-based memory corruption errors using SafeStack: Clang command line option and function attribute
This patch adds the -fsanitize=safe-stack command line argument for clang, which enables the Safe Stack protection (see http://reviews.llvm.org/D6094 for the detailed description of the Safe Stack). This patch is our implementation of the safe stack on top of Clang. The patches make the following changes: - Add -fsanitize=safe-stack and -fno-sanitize=safe-stack options to clang to control safe stack usage (the safe stack is disabled by default). - Add __attribute__((no_sanitize("safe-stack"))) attribute to clang that can be used to disable the safe stack for individual functions even when enabled globally. 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/D6095 llvm-svn: 239762
Diffstat (limited to 'clang/test/CodeGen/stack-protector.c')
-rw-r--r--clang/test/CodeGen/stack-protector.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/CodeGen/stack-protector.c b/clang/test/CodeGen/stack-protector.c
index 2fb9b2cf7e6..8039b6059ef 100644
--- a/clang/test/CodeGen/stack-protector.c
+++ b/clang/test/CodeGen/stack-protector.c
@@ -6,6 +6,8 @@
// SSPSTRONG: define void @test1(i8* %msg) #0 {
// RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 3 | FileCheck -check-prefix=SSPREQ %s
// SSPREQ: define void @test1(i8* %msg) #0 {
+// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack | FileCheck -check-prefix=SAFESTACK %s
+// SAFESTACK: define void @test1(i8* %msg) #0 {
typedef __SIZE_TYPE__ size_t;
@@ -26,3 +28,5 @@ void test1(const char *msg) {
// SSPSTRONG: attributes #{{.*}} = { nounwind sspstrong{{.*}} }
// SSPREQ: attributes #{{.*}} = { nounwind sspreq{{.*}} }
+
+// SAFESTACK: attributes #{{.*}} = { nounwind safestack{{.*}} }
OpenPOWER on IntegriCloud