Parcourir la source

[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 il y a 6 ans
Parent
commit
1315b54b5d
1 fichiers modifiés avec 4 ajouts et 4 suppressions
  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