selftests/sgx: Ensure enclave data available during debug print

In support of debugging the SGX tests print details from
the enclave and its memory mappings if any failure is encountered
during enclave loading.

When a failure is encountered no data is printed because the
printing of the data is preceded by cleanup of the data.

Move the data cleanup after the data print.

Fixes: 1471721489 ("selftests/sgx: Dump segments and /proc/self/maps only on failure")
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Shuah Khan <skhan@linuxfoundation.org>
Link: https://lkml.kernel.org/r/dab672f771e9b99e50c17ae2a75dc0b020cb0ce9.1644355600.git.reinette.chatre@intel.com
This commit is contained in:
Reinette Chatre 2022-02-08 13:48:41 -08:00 committed by Dave Hansen
parent fff36bcbfd
commit 2db703fc3b

View File

@ -186,8 +186,6 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl,
return true;
err:
encl_delete(encl);
for (i = 0; i < encl->nr_segments; i++) {
seg = &encl->segment_tbl[i];
@ -208,6 +206,8 @@ err:
TH_LOG("Failed to initialize the test enclave.\n");
encl_delete(encl);
return false;
}