about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRaoul Strackx <raoul.strackx@fortanix.com>2019-10-21 15:10:32 +0200
committerRaoul Strackx <raoul.strackx@fortanix.com>2019-10-21 15:10:32 +0200
commitfc500368485bd2ebafea6a37da30f49c8be75aac (patch)
tree65c1cad9b6a692a9bd7f245876cb384ae7e78dbb /src
parentb7a9c285a50f3a94c44687ba9ff3ab0648243aaa (diff)
downloadrust-fc500368485bd2ebafea6a37da30f49c8be75aac.tar.gz
rust-fc500368485bd2ebafea6a37da30f49c8be75aac.zip
fixed ac vulnerability
Diffstat (limited to 'src')
-rw-r--r--src/libstd/sys/sgx/abi/entry.S10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libstd/sys/sgx/abi/entry.S b/src/libstd/sys/sgx/abi/entry.S
index c35e49b1dc6..4f8673a1907 100644
--- a/src/libstd/sys/sgx/abi/entry.S
+++ b/src/libstd/sys/sgx/abi/entry.S
@@ -121,6 +121,16 @@ sgx_entry:
     fnstcw %gs:tcsls_user_fcw
 /*  reset user state */
     cld /* x86-64 ABI requires DF to be unset at function entry/exit */
+
+/*  making sure AC flag is not set in rflags */
+/*  avoid using the 'clac' instruction to be compatible with older compilers */
+    push %rcx
+    pushfq
+    popq %rcx
+    and $0xFFFFFFFFFFFBFFFF, %rcx
+    push %rcx
+    popfq
+
 /*  check for debug buffer pointer */
     testb  $0xff,DEBUG(%rip)
     jz .Lskip_debug_init