Skip to contentSkip to conversation

selftests/sgx: Add "test_encl.elf" to TEST_FILES

PATCH RESEND In review Yi Lai 5 participants 6 messages Apr 21, 2023 – May 8, 2023

Subsystems (2)
lore
Share & tools
lore

Yi Lai

author
#0 lore raw

PATCH RESEND 1/1 selftests/sgx: Add "test_encl.elf" to TEST_FILES

The "test_encl.elf" file used by test_sgx is not installed in INSTALL_PATH. Attempting to execute test_sgx causes false negative:

"
enclave executable open(): No such file or directory main.c:188:unclobbered_vdso:Failed to load the test enclave. "

Add "test_encl.elf" to TEST_FILES so that it will be installed.

Fixes 2adcba79e69d ("selftests/x86: Add a selftest for SGX")
---
 tools/testing/selftests/sgx/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/sgx/Makefile +1 -0
index 75af864e07b6..50aab6b57da3 100644
@@ -17,6 +17,7 @@ ENCL_CFLAGS := -Wall -Werror -static -nostdlib -nostartfiles -fPIC \
 	       -fno-stack-protector -mrdrnd $(INCLUDES)
 
 TEST_CUSTOM_PROGS := $(OUTPUT)/test_sgx
+TEST_FILES := $(OUTPUT)/test_encl.elf
 
 ifeq ($(CAN_BUILD_X86_64), 1)
 all: $(TEST_CUSTOM_PROGS) $(OUTPUT)/test_encl.elf
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 30 lines · Yi Lai

The "test_encl.elf" file used by test_sgx is not installed in INSTALL_PATH. Attempting to execute test_sgx causes false negative:

"
enclave executable open(): No such file or directory main.c:188:unclobbered_vdso:Failed to load the test enclave. "

Add "test_encl.elf" to TEST_FILES so that it will be installed.

Fixes 2adcba79e69d ("selftests/x86: Add a selftest for SGX")
---
 tools/testing/selftests/sgx/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/sgx/Makefile +1 -0
index 75af864e07b6..50aab6b57da3 100644
@@ -17,6 +17,7 @@ ENCL_CFLAGS := -Wall -Werror -static -nostdlib -nostartfiles -fPIC \
 	       -fno-stack-protector -mrdrnd $(INCLUDES)
 
 TEST_CUSTOM_PROGS := $(OUTPUT)/test_sgx
+TEST_FILES := $(OUTPUT)/test_encl.elf
 
 ifeq ($(CAN_BUILD_X86_64), 1)
 all: $(TEST_CUSTOM_PROGS) $(OUTPUT)/test_encl.elf
Signature · 1 line
2.25.1

BR, Jarkko

#2 lore raw
In reply to Yi Lai
Quoted 2 lines · Yi Lai

The "test_encl.elf" file used by test_sgx is not installed in INSTALL_PATH. Attempting to execute test_sgx causes false negative:

I've ran the following on next-20230427:
make -C tools/testing/selftests O=build2 -j nproc

find | grep test_encl.elf
./build2/kselftest/sgx/test_encl.elf

test_encl.elf is being copied already. Am i missing something?

Quoted 19 lines

"
enclave executable open(): No such file or directory main.c:188:unclobbered_vdso:Failed to load the test enclave. "

Add "test_encl.elf" to TEST_FILES so that it will be installed.

Fixes 2adcba79e69d ("selftests/x86: Add a selftest for SGX")
---
 tools/testing/selftests/sgx/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/sgx/Makefile +0 -0
index 75af864e07b6..50aab6b57da3 100644

tools/testing/selftests/sgx/Makefile ENCL_CFLAGS := -Wall -Werror -static -nostdlib -nostartfiles -fPIC \ · line 20

Quoted 4 lines
tools/testing/selftests/sgx/Makefile +1 -0
@@ -17,6 +17,7 @@ ENCL_CFLAGS := -Wall -Werror -static -nostdlib -nostartfiles -fPIC \
 	       -fno-stack-protector -mrdrnd $(INCLUDES)
 
 TEST_CUSTOM_PROGS := $(OUTPUT)/test_sgx
+TEST_FILES := $(OUTPUT)/test_encl.elf

I think this isn't needed just like sign_key.o is being copied already. test_encl.elf is being copied.

Quoted 3 lines
tools/testing/selftests/sgx/Makefile +0 -0
 ifeq ($(CAN_BUILD_X86_64), 1)
 all: $(TEST_CUSTOM_PROGS) $(OUTPUT)/test_encl.elf
Signature · 2 lines
BR,
Muhammad Usama Anjum
maintainer
#3 lore raw
Quoted 10 lines · Muhammad Usama Anjum
Quoted 2 lines · Yi Lai

The "test_encl.elf" file used by test_sgx is not installed in INSTALL_PATH. Attempting to execute test_sgx causes false negative:

I've ran the following on next-20230427:
make -C tools/testing/selftests O=build2 -j nproc

find | grep test_encl.elf
./build2/kselftest/sgx/test_encl.elf

test_encl.elf is being copied already. Am i missing something?

I don't have access right to apply this to tip/x86/sgx.

BR, Jarkko

#4 lore raw
In reply to Muhammad Usama Anjum
Quoted 31 lines · Muhammad Usama Anjum
Quoted 2 lines · Yi Lai

The "test_encl.elf" file used by test_sgx is not installed in INSTALL_PATH. Attempting to execute test_sgx causes false negative:

I've ran the following on next-20230427:
make -C tools/testing/selftests O=build2 -j nproc

find | grep test_encl.elf
./build2/kselftest/sgx/test_encl.elf

test_encl.elf is being copied already. Am i missing something?

Quoted 21 lines

"
enclave executable open(): No such file or directory main.c:188:unclobbered_vdso:Failed to load the test enclave. "

Add "test_encl.elf" to TEST_FILES so that it will be installed.

Fixes 2adcba79e69d ("selftests/x86: Add a selftest for SGX")
---
 tools/testing/selftests/sgx/Makefile | 1 +
 1 file changed, 1 insertion(+)
tools/testing/selftests/sgx/Makefile +0 -0
index 75af864e07b6..50aab6b57da3 100644
@@ -17,6 +17,7 @@ ENCL_CFLAGS := -Wall -Werror -static -nostdlib -nostartfiles -fPIC \
 	       -fno-stack-protector -mrdrnd $(INCLUDES)
 
Quoted 5 lines

tools/testing/selftests/sgx/Makefile ENCL_CFLAGS := -Wall -Werror -static -nostdlib -nostartfiles -fPIC \ · line 20

Quoted 2 lines
tools/testing/selftests/sgx/Makefile +1 -0
 TEST_CUSTOM_PROGS := $(OUTPUT)/test_sgx
+TEST_FILES := $(OUTPUT)/test_encl.elf

I think this isn't needed just like sign_key.o is being copied already. test_encl.elf is being copied.

Quoted 1 line

Hi,

When using tools/testing/selftests/kselftest_install.sh

test_encl.elf can be built but not copied to tools/testing/selftests/kselftest_install/sgx/

Quoted 3 lines
Quoted 2 lines

ifeq ($(CAN_BUILD_X86_64), 1)
all: $(TEST_CUSTOM_PROGS) $(OUTPUT)/test_encl.elf

Regards,
Yi Lai

maintainer
#5 lore raw
In reply to Yi Lai
Quoted 8 lines · Yi Lai

The "test_encl.elf" file used by test_sgx is not installed in INSTALL_PATH. Attempting to execute test_sgx causes false negative:

"
enclave executable open(): No such file or directory main.c:188:unclobbered_vdso:Failed to load the test enclave. "

Quoted 4 lines

Add "test_encl.elf" to TEST_FILES so that it will be installed.

Fixes 2adcba79e69d ("selftests/x86: Add a selftest for SGX")

Applied now to linux-kselftest fixes for the next rc.

Thank for your the fix.

thanks,
-- Shuah