- A couple of fixes and improvements to the SGX selftests
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEzv7L6UO9uDPlPSfHEsHwGGHeVUoFAmI4WVQACgkQEsHwGGHe VUpL6w//RpMzMnbo0j45xJfEwrw/zw0nB4d7/j185wqqxbvLwZZe1Xb4RfLJ28Bn iW4mQG15H0tiR3EeOnR5QwIqEOYcWb1IkYtTQFk//bzyto2jb19S+/zDKvj0M9zM apA1s+faKjyvcGdRUmZR6YqnFCpfGCaB060AYV2hVoAb9NqktUl4gbRNjJh9Fl2M PAPBK7VhVD4ycq1FnOw3zCky5uGCWOigxz4FeOelcT39ETdLXL9TgHO6aHiapco9 rNbCI5L47dpjVSSZlmCJHaEgeaU9jyOiEzbQh4VPR88eDggLhkvQwA4POF+q4xHs uVv9pCRUWEs0BDBc3itDsVTpmv8V9OIXiJhVEbkSM2ZHmlZfkZT1MiH6HChi7pNO tyFHKEiutUAqCrS9fMrqxDM1vXeH/wPRGhN/wtBY7UzcDbLRAHLW5fk2HinVTTx2 hcdrz2ku16J/ioxP2BmtdAIdYZqusReSoAPI5Z1UpyUNtKvNEXUj8a0y/w9SYTV4 M7KakbZAQnh56HyV0j5GlM5xRvOpmJQVZQJrOi4h4xm97mO1eGfL4E9boBKFi/PF lTSkbNs9kHSqgFjjKNC0+a28jGa8BrVfRbD39zcUoUYWo68wDVIq6gB1RxQG0l8J QYxXQekHvRZ/NINbcpY6okE9L9X1CPPaHfs2+7VRsxjjHWUcIYU= =uGS4 -----END PGP SIGNATURE----- Merge tag 'x86_sgx_for_v5.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull x86 SGX updates from Borislav Petkov: - A couple of fixes and improvements to the SGX selftests * tag 'x86_sgx_for_v5.18_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: selftests/sgx: Treat CC as one argument selftests/x86: Add validity check and allow field splitting selftests/sgx: Remove extra newlines in test output selftests/sgx: Ensure enclave data available during debug print selftests/sgx: Do not attempt enclave build without valid enclave selftests/sgx: Fix NULL-pointer-dereference upon early test failure
This commit is contained in:
commit
61e2658e37
@ -4,7 +4,7 @@ include ../lib.mk
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
CAN_BUILD_X86_64 := $(shell ../x86/check_cc.sh $(CC) \
|
||||
CAN_BUILD_X86_64 := $(shell ../x86/check_cc.sh "$(CC)" \
|
||||
../x86/trivial_64bit_program.c)
|
||||
|
||||
ifndef OBJCOPY
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
void encl_delete(struct encl *encl)
|
||||
{
|
||||
struct encl_segment *heap_seg = &encl->segment_tbl[encl->nr_segments - 1];
|
||||
struct encl_segment *heap_seg;
|
||||
|
||||
if (encl->encl_base)
|
||||
munmap((void *)encl->encl_base, encl->encl_size);
|
||||
@ -32,10 +32,11 @@ void encl_delete(struct encl *encl)
|
||||
if (encl->fd)
|
||||
close(encl->fd);
|
||||
|
||||
munmap(heap_seg->src, heap_seg->size);
|
||||
|
||||
if (encl->segment_tbl)
|
||||
if (encl->segment_tbl) {
|
||||
heap_seg = &encl->segment_tbl[encl->nr_segments - 1];
|
||||
munmap(heap_seg->src, heap_seg->size);
|
||||
free(encl->segment_tbl);
|
||||
}
|
||||
|
||||
memset(encl, 0, sizeof(*encl));
|
||||
}
|
||||
|
@ -146,7 +146,8 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl,
|
||||
|
||||
if (!encl_load("test_encl.elf", encl, heap_size)) {
|
||||
encl_delete(encl);
|
||||
TH_LOG("Failed to load the test enclave.\n");
|
||||
TH_LOG("Failed to load the test enclave.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!encl_measure(encl))
|
||||
@ -185,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];
|
||||
|
||||
@ -205,7 +204,9 @@ static bool setup_test_encl(unsigned long heap_size, struct encl *encl,
|
||||
fclose(maps_file);
|
||||
}
|
||||
|
||||
TH_LOG("Failed to initialize the test enclave.\n");
|
||||
TH_LOG("Failed to initialize the test enclave.");
|
||||
|
||||
encl_delete(encl);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ CC="$1"
|
||||
TESTPROG="$2"
|
||||
shift 2
|
||||
|
||||
if "$CC" -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then
|
||||
if [ -n "$CC" ] && $CC -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then
|
||||
echo 1
|
||||
else
|
||||
echo 0
|
||||
|
Loading…
Reference in New Issue
Block a user