From fc500368485bd2ebafea6a37da30f49c8be75aac Mon Sep 17 00:00:00 2001 From: Raoul Strackx Date: Mon, 21 Oct 2019 15:10:32 +0200 Subject: fixed ac vulnerability --- src/libstd/sys/sgx/abi/entry.S | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libstd') 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 -- cgit 1.4.1-3-g733a5