瀏覽代碼

[Pal/Linux-SGX] enclave_entry.S: Fix offset of MXCSR "reset" XSAVE area

Before EEXIT, Graphene-SGX resets the extended state (XSAVE) area to the
default state (of mostly zero bytes). This prevents the leakage of
x87/SSE/AVX/MPX register values inside the enclave. However, the
previous default state had an incorrectly calculated offset of MXCSR. This
commit fixes the offset of MXCSR. (This particular error manifested in
spurious "Numeric underflow (#U)" SSE hardware exceptions on OpenVINO.)
Dmitrii Kuvaiskii 6 年之前
父節點
當前提交
1315b54b5d
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      Pal/src/host/Linux-SGX/enclave_entry.S

+ 4 - 4
Pal/src/host/Linux-SGX/enclave_entry.S

@@ -585,10 +585,10 @@ __morestack:
 .section .rodata
 	.balign 64
 .Lxrstor_init_arg:
-	.byte 0x7f, 0x03 	# FCW
-	.skip 6, 0
-	.byte 0x80, 0x1f, 0, 0 	# MXCSR
-	.skip 500, 0	 	# rest of fxstore area
+	.byte 0x7f, 0x03        # FCW
+	.skip 22, 0             # FSW, FTW, FOP, etc: all zero-initialized
+	.byte 0x80, 0x1f, 0, 0  # MXCSR
+	.skip 484, 0            # rest of fxstore area
 
 	.skip 15, 0	 	# XSTATE_BV and XCOMP_BV[55:0]
 	.byte 0x80	 	# XCOMP_BV[63:56] i.e. "compact" format