about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-28 04:41:13 +0000
committerbors <bors@rust-lang.org>2023-05-28 04:41:13 +0000
commit2560b80a08597e4192aa3ee5a4670e36a5e4a7dd (patch)
treeec75c4a52fa5946872d23a4cc34216d775700e3e /tests
parentb9c5fdc888e05be88269a47d40fd0d911ec2be0b (diff)
parent019d75b44e3f4349495890453d2d154a8f7ba116 (diff)
downloadrust-2560b80a08597e4192aa3ee5a4670e36a5e4a7dd.tar.gz
rust-2560b80a08597e4192aa3ee5a4670e36a5e4a7dd.zip
Auto merge of #112000 - wesleywiser:safestack, r=Amanieu
Add support for LLVM SafeStack

Adds support for LLVM [SafeStack] which provides backward edge control
flow protection by separating the stack into two parts: data which is
only accessed in provable safe ways is allocated on the normal stack
(the "safe stack") and all other data is placed in a separate allocation
(the "unsafe stack").

SafeStack support is enabled by passing `-Zsanitizer=safestack`.

[SafeStack]: https://clang.llvm.org/docs/SafeStack.html

cc `@rcvalle` #39699
Diffstat (limited to 'tests')
-rw-r--r--tests/codegen/sanitizer-safestack-attr-check.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/codegen/sanitizer-safestack-attr-check.rs b/tests/codegen/sanitizer-safestack-attr-check.rs
new file mode 100644
index 00000000000..b73ed00e730
--- /dev/null
+++ b/tests/codegen/sanitizer-safestack-attr-check.rs
@@ -0,0 +1,11 @@
+// This tests that the safestack attribute is applied when enabling the safe-stack sanitizer.
+//
+// needs-sanitizer-safestack
+// compile-flags: -Zsanitizer=safestack
+
+#![crate_type = "lib"]
+
+// CHECK: ; Function Attrs:{{.*}}safestack
+pub fn tagged() {}
+
+// CHECK: attributes #0 = {{.*}}safestack