lsds / TaLoS

Efficient TLS termination inside Intel SGX enclaves for existing applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Some memory not freed

InfiniteSamuel opened this issue · comments

commented

I recently discovered a bug. In /src/talos/patch/tasn_fre.c.patch::24, you have a #else macro, which is unnecessary. The code should be like this:

static void smart_free(void* ptr) {
#ifdef COMPILE_WITH_INTEL_SGX
	if (sgx_is_within_enclave(ptr, 1)) {
//#else
#endif
		free(ptr);
//#endif
#ifdef COMPILE_WITH_INTEL_SGX
	} else {
		ocall_free(ptr);
	}
#endif
}

Otherwise the ptr will not be freed.

commented

Actually if you decrease the <HeapMaxSize>0x4600000</HeapMaxSize> by about 256 times in the enclave.config.xml, you will discover this bug soon enough.

Thank you for discovering this bug. Commit 1332eec fixes this issue.