What am I doing wrong with using xbegin in the enclave? First of all, I checked tsx outside enclave - it works (I tested _xbegin() from <immintrin.h>). Then I tried to use different examples of xbegin realisations for !Windows! inside enclave. I also tried this https://software.intel.com/content/www/us/en/develop/documentation/cpp-compiler-developer-guide-and-reference/top/compiler-reference/intrinsics/intrinsics-for-intel-advanced-vector-extensions-2/intrinsics-for-intel-transactional-synchronization-extensions-intel-tsx/intrinsics-for-restricted-transactional-memory-operations/xbegin.html and this https://github.com/jjoachim/pinhw2/blob/master/source/tools/Tsx/hlet_rtm.h And I do in the enclave smth like this:

if (_xbegin() == _XBEGIN_STARTED){
    else {
  • This is not a security question, but what seems to be the problem? Why do you feel you are doing something wrong? If your transactions abort immediately it may be due to TAA protections, what does eax read? – Margaret Bloom Mar 14 at 16:26
  • hmm... but the docs say sgx enclave supports using tsx (and I thought i wouldn't have problems with it), and, yeah, my transactions abort immediately every time. I saw example of using this here github.com/IAIK/sgxrop , but it is for Linux... I think maybe Windows disagrees with me about using tsx in the enclave – im_sorry Mar 14 at 16:44
  • 1
    TSX is supported in SGX, in theory. But since TSX enables information disclosure, it has been disabled with a microcode update (see this, page 3, before "Background") when running inside an enclave. However, you can still write the code to use it, since the abortion paths are mandatory. You'll just miss the optimizations. – Margaret Bloom Mar 14 at 17:10
  • Yeah...I see. I didn't know about disabling tsx in sgx. Thank you!! – im_sorry Mar 15 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.