From ede25ad31966212d8f747abf33001231e63f9ab3 Mon Sep 17 00:00:00 2001 From: Raoul Strackx Date: Tue, 27 Feb 2024 16:29:21 +0100 Subject: [PATCH] Fix LVI tests after making frame pointers easily enableable --- .../cmake_plus_one_cxx_global_asm.checks | 7 ++++++- .../print.with_frame_pointers.checks | 7 +++++++ .../{print.checks => print.without_frame_pointers.checks} | 0 tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh | 8 +++++--- 4 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks rename tests/run-make/x86_64-fortanix-unknown-sgx-lvi/{print.checks => print.without_frame_pointers.checks} (100%) diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks index d4a3d4479014c..1d8fc96ad50cd 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/cmake_plus_one_cxx_global_asm.checks @@ -1,2 +1,7 @@ CHECK: cmake_plus_one_cxx_global_asm -CHECK: lfence +CHECK-NEXT: movl +CHECK-NEXT: lfence +CHECK-NEXT: incl +CHECK-NEXT: shlq $0x0, (%rsp) +CHECK-NEXT: lfence +CHECK-NEXT: retq diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks new file mode 100644 index 0000000000000..485e20e3111f7 --- /dev/null +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.with_frame_pointers.checks @@ -0,0 +1,7 @@ +CHECK: print +CHECK: lfence +CHECK: popq +CHECK: popq +CHECK-NEXT: popq [[REGISTER:%[a-z]+]] +CHECK-NEXT: lfence +CHECK-NEXT: jmpq *[[REGISTER]] diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks similarity index 100% rename from tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks rename to tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.without_frame_pointers.checks diff --git a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh index 04a34724518e8..a36ad916bebe3 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh @@ -34,8 +34,9 @@ function check { ${enclave} > ${asm} ${filecheck} --input-file ${asm} ${checks} - if [ "${func_re}" != "rust_plus_one_global_asm" && - "${func_re}" != "cmake_plus_one_c_global_asm" ]; then + if [ "${func_re}" != "rust_plus_one_global_asm" ] && + [ "${func_re}" != "cmake_plus_one_c_global_asm" ] && + [ "${func_re}" != "cmake_plus_one_cxx_global_asm" ]; then # The assembler cannot avoid explicit `ret` instructions. Sequences # of `shlq $0x0, (%rsp); lfence; retq` are used instead. # https://www.intel.com/content/www/us/en/developer/articles/technical/ @@ -48,7 +49,8 @@ build check "unw_getcontext" unw_getcontext.checks check "__libunwind_Registers_x86_64_jumpto" jumpto.checks -check 'std::io::stdio::_print::[[:alnum:]]+' print.checks +check 'std::io::stdio::_print::[[:alnum:]]+' print.with_frame_pointers.checks || + check 'std::io::stdio::_print::[[:alnum:]]+' print.without_frame_pointers.checks check rust_plus_one_global_asm rust_plus_one_global_asm.checks check cc_plus_one_c cc_plus_one_c.checks