about summary refs log tree commit diff
path: root/src/libstd/sys_common
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-04-02 13:47:31 +0200
committerGitHub <noreply@github.com>2019-04-02 13:47:31 +0200
commitd0d34663375f32f766aa290fa201fdc72ce7ddcf (patch)
tree75b10cd677718373adfa76658ae592bb8fac39ad /src/libstd/sys_common
parent85a82ac334dc6fc3f450ea52f3baadc463be2843 (diff)
parent6d96c8979d37dd137d29a992fc9b962ebe089aaf (diff)
downloadrust-d0d34663375f32f766aa290fa201fdc72ce7ddcf.tar.gz
rust-d0d34663375f32f766aa290fa201fdc72ce7ddcf.zip
Rollup merge of #59613 - jethrogb:jb/waitqueue-wait-unwind, r=alexcrichton
SGX target: convert a bunch of panics to aborts

Fixes https://github.com/fortanix/rust-sgx/issues/86, https://github.com/fortanix/rust-sgx/issues/103 and in general protect preemptively against Iago attacks by aborting instead of unwinding in potentially unexpected situations.
Diffstat (limited to 'src/libstd/sys_common')
-rw-r--r--src/libstd/sys_common/mod.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs
index 883ab34f07c..4c64e9f3afb 100644
--- a/src/libstd/sys_common/mod.rs
+++ b/src/libstd/sys_common/mod.rs
@@ -28,6 +28,15 @@ macro_rules! rtassert {
     })
 }
 
+#[allow(unused_macros)] // not used on all platforms
+macro_rules! rtunwrap {
+    ($ok:ident, $e:expr) => (if let $ok(v) = $e {
+        v
+    } else {
+        rtabort!(concat!("unwrap failed: ", stringify!($e)));
+    })
+}
+
 pub mod alloc;
 pub mod at_exit_imp;
 #[cfg(feature = "backtrace")]