diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-06-06 12:00:31 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-06 12:00:31 +0200 |
| commit | 92327c05f1c54b403f3537a275baf469cdbe6632 (patch) | |
| tree | bb7b31e0907ceb5e69b33894c727f5804db61756 | |
| parent | fd9bf594366e73efb1a26a023e0b4de8eff82b94 (diff) | |
| parent | b35f243c89907ba86b55fac5f86f591f7f342cde (diff) | |
| download | rust-92327c05f1c54b403f3537a275baf469cdbe6632.tar.gz rust-92327c05f1c54b403f3537a275baf469cdbe6632.zip | |
Rollup merge of #111058 - fortanix:raoul/fix_lvi_mitigations, r=cuviper
Correct fortanix LVI test print function A recent change resulted in a different machine code for the `print` function. This caused the LVI test for this function to fail. This PR: - Fixes the test for the `print` function - Simplified the test a bit so future modifications are more unlikely cc: ``@jethrogb``
| -rw-r--r-- | tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks | 8 | ||||
| -rw-r--r-- | tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh | 9 |
2 files changed, 13 insertions, 4 deletions
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.checks index 8a5493650a7..e02fe094889 100644 --- a/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks +++ b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks @@ -1,6 +1,6 @@ CHECK: print CHECK: lfence -CHECK: lfence -CHECK: lfence -CHECK: callq 0x{{[[:xdigit:]]*}} <_Unwind_Resume> -CHECK-NEXT: ud2 +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/script.sh b/tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh index 235bb603b84..04a34724518 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 @@ -33,6 +33,15 @@ function check { ${objdump} --disassemble-symbols="${func}" --demangle \ ${enclave} > ${asm} ${filecheck} --input-file ${asm} ${checks} + + if [ "${func_re}" != "rust_plus_one_global_asm" && + "${func_re}" != "cmake_plus_one_c_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/ + # software-security-guidance/technical-documentation/load-value-injection.html + ${filecheck} --implicit-check-not ret --input-file ${asm} ${checks} + fi } build |
