Skip to content

Commit daedb79

Browse files
committed
Prevent attacker from manipulating FPU tag word used in SGX enclave
Insufficient sanitization of the x87 FPU tag word in the trusted enclave runtime allowed unprivileged adversaries in the containing host application to induce incoherent or unexpected results for ABI-compliant compiled enclave application code that uses the x87 FPU. Vulnerability was disclosed to us by Fritz Alder, Jo Van Bulck, David Oswald and Frank Piessens
1 parent e55d3f9 commit daedb79

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

+7
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ sgx_entry:
177177
jz .Lskip_debug_init
178178
mov %r10,%gs:tcsls_debug_panic_buf_ptr
179179
.Lskip_debug_init:
180+
/* reset cpu state */
181+
mov %rdx, %r10
182+
mov $-1, %rax
183+
mov $-1, %rdx
184+
xrstor .Lxsave_clear(%rip)
185+
mov %r10, %rdx
186+
180187
/* check if returning from usercall */
181188
mov %gs:tcsls_last_rsp,%r11
182189
test %r11,%r11

0 commit comments

Comments
 (0)