Skip to content

Commit 92327c0

Browse files
authored
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``
2 parents fd9bf59 + b35f243 commit 92327c0

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CHECK: print
22
CHECK: lfence
3-
CHECK: lfence
4-
CHECK: lfence
5-
CHECK: callq 0x{{[[:xdigit:]]*}} <_Unwind_Resume>
6-
CHECK-NEXT: ud2
3+
CHECK: popq
4+
CHECK-NEXT: popq [[REGISTER:%[a-z]+]]
5+
CHECK-NEXT: lfence
6+
CHECK-NEXT: jmpq *[[REGISTER]]

tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh

+9
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ function check {
3333
${objdump} --disassemble-symbols="${func}" --demangle \
3434
${enclave} > ${asm}
3535
${filecheck} --input-file ${asm} ${checks}
36+
37+
if [ "${func_re}" != "rust_plus_one_global_asm" &&
38+
"${func_re}" != "cmake_plus_one_c_global_asm" ]; then
39+
# The assembler cannot avoid explicit `ret` instructions. Sequences
40+
# of `shlq $0x0, (%rsp); lfence; retq` are used instead.
41+
# https://www.intel.com/content/www/us/en/developer/articles/technical/
42+
# software-security-guidance/technical-documentation/load-value-injection.html
43+
${filecheck} --implicit-check-not ret --input-file ${asm} ${checks}
44+
fi
3645
}
3746

3847
build

0 commit comments

Comments
 (0)