Skip to content

Commit fc50036

Browse files
committed
fixed ac vulnerability
1 parent b7a9c28 commit fc50036

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libstd/sys/sgx/abi/entry.S

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,16 @@ sgx_entry:
121121
fnstcw %gs:tcsls_user_fcw
122122
/* reset user state */
123123
cld /* x86-64 ABI requires DF to be unset at function entry/exit */
124+
125+
/* making sure AC flag is not set in rflags */
126+
/* avoid using the 'clac' instruction to be compatible with older compilers */
127+
push %rcx
128+
pushfq
129+
popq %rcx
130+
and $0xFFFFFFFFFFFBFFFF, %rcx
131+
push %rcx
132+
popfq
133+
124134
/* check for debug buffer pointer */
125135
testb $0xff,DEBUG(%rip)
126136
jz .Lskip_debug_init

0 commit comments

Comments
 (0)