Skip to contentSkip to conversation

selftest/sgx: Remove printing of segments during enclave load

PATCH In review Sean Christopherson 2 participants 2 messages Mar 30, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftest/sgx: Remove printing of segments during enclave load

Don't print the enclave's segment information during load. Most failures are unlikely to be related to the loader/protections, and without context, e.g. printing what the numbers mean, the output is unhelpful and distracting.

---
 tools/testing/selftests/sgx/load.c | 3 ---
 1 file changed, 3 deletions(-)
tools/testing/selftests/sgx/load.c +0 -3
index 35a2d7a47dd5..1a10b92adfa0 100644
@@ -204,9 +204,6 @@ bool encl_load(const char *path, struct encl *encl)
 		seg->offset = (phdr->p_offset & PAGE_MASK) - src_offset;
 		seg->size = (phdr->p_filesz + PAGE_SIZE - 1) & PAGE_MASK;
 
-		printf("0x%016lx 0x%016lx 0x%02x\n", seg->offset, seg->size,
-		       seg->prot);
-
 		j++;
 	}
 
Signature · 1 line
2.24.1
#1 lore raw
Quoted 15 lines · Sean Christopherson

Don't print the enclave's segment information during load. Most failures are unlikely to be related to the loader/protections, and without context, e.g. printing what the numbers mean, the output is unhelpful and distracting.

---
 tools/testing/selftests/sgx/load.c | 3 ---
 1 file changed, 3 deletions(-)
tools/testing/selftests/sgx/load.c +0 -0
index 35a2d7a47dd5..1a10b92adfa0 100644

tools/testing/selftests/sgx/load.c bool encl_load(const char *path, struct encl *encl) · line 209

Quoted 6 lines
tools/testing/selftests/sgx/load.c +0 -3
@@ -204,9 +204,6 @@ bool encl_load(const char *path, struct encl *encl)
 		seg->offset = (phdr->p_offset & PAGE_MASK) - src_offset;
 		seg->size = (phdr->p_filesz + PAGE_SIZE - 1) & PAGE_MASK;
 
-		printf("0x%016lx 0x%016lx 0x%02x\n", seg->offset, seg->size,
-		       seg->prot);
-

It is really useful to have this always there since it reveals immediately bunch of regressions when touching the loader. It has shown already useful at least a dozen of times. Thus, I don't seriously want to remove it.

I suggest that you add something like "--print-layout" to the test program. I'm cool with *optionally* having the print. You appreciate to have it there when something goes wrong.

/Jarkko