소스 검색

[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