]> git.lizzy.rs Git - rust.git/commitdiff
fixed ac vulnerability
authorRaoul Strackx <raoul.strackx@fortanix.com>
Mon, 21 Oct 2019 13:10:32 +0000 (15:10 +0200)
committerRaoul Strackx <raoul.strackx@fortanix.com>
Mon, 21 Oct 2019 13:10:32 +0000 (15:10 +0200)
src/libstd/sys/sgx/abi/entry.S

index c35e49b1dc6ea2453ca1f13fbec730963e76cb7b..4f8673a1907d72c43468a893b6ed99a3cc83e41f 100644 (file)
@@ -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