Community
cancel
Showing results for 
Search instead for 
Did you mean: 
lieser__philippe
Beginner
364 Views

Throw in catch block results in read access violation in 64-bit mode

The following ecall code causes a read access violation during destruction of the msg string during unwinding the stack in the catch block of exceptionTest() (see picture for callstack). The exception is "Unhandled exception thrown: read access violation. fm was 0xFFFFFFFFFFFFFFBF.".

Note that this only happens if build in 64-bit mode. With 32-bit, everything works fine. And it only happens if the std::string in long enough. E.g. with std::string msg( "foo" ); it works without problems.

Is there something in the code not allowed in SGX (e.g. throw in catch block), or anything else wrong with it?

For me it looks like it also could be a problem in the c++ standard library shipped in the SDK for SGX. Is there a better place to report such potential bugs in the SDK than this forum?

Tested with

  • SGX SDK 2.3.100.49777
  • sgx_tcxx.lib
  • VS 2017 with Toolset v140/v141
#include "Enclave_t.h"

#include <exception>
#include <string>

static void exceptionTest()
{
	try
	{
		throw std::exception( "foobar" );
	}
	catch ( std::exception& )
	{
		std::string msg( "012345678901234567890123456789" );
		throw std::exception( "bar" );
	}
}

void ecall_exceptionTest()
{
	try
	{
		exceptionTest();
	}
	catch ( std::exception& )
	{
	}
}

 

0 Kudos
0 Replies
Reply