Skip to content

Commit cfd8105

Browse files
authored
Rollup merge of rust-lang#108986 - fortanix:raoul/sync_lvi_patches, r=cuviper
sync LVI tests The LVI tests for the `x86_64-fortanix-unknown-sgx` target have gotten out of sync. LVI is still mitigated correctly, but the LVI tests need minor modifications. Other (non LVI-related) tests fail when the target applies LVI mitigations as they assume the generated code contains forbidden instructions such as `retq`. These tests are ignored for the sgx environment. cc: `@jethrogb`
2 parents eb82a5a + d69ebf7 commit cfd8105

11 files changed

+48
-39
lines changed

tests/assembly/is_aligned.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// assembly-output: emit-asm
22
// min-llvm-version: 15.0
33
// only-x86_64
4+
// ignore-sgx
45
// revisions: opt-speed opt-size
56
// [opt-speed] compile-flags: -Copt-level=1
67
// [opt-size] compile-flags: -Copt-level=s

tests/assembly/strict_provenance.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// assembly-output: emit-asm
22
// compile-flags: -Copt-level=1
33
// only-x86_64
4+
// ignore-sgx
45
// min-llvm-version: 15.0
56
#![crate_type = "rlib"]
67

tests/assembly/x86_64-floating-point-clamp.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// assembly-output: emit-asm
55
// compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
66
// only-x86_64
7+
// ignore-sgx
78

89
// CHECK-LABEL: clamp_demo:
910
#[no_mangle]

tests/assembly/x86_64-fortanix-unknown-sgx-lvi-generic-load.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub extern fn plus_one(r: &mut u64) {
1111

1212
// CHECK: plus_one
1313
// CHECK: lfence
14-
// CHECK-NEXT: addq
14+
// CHECK-NEXT: incq
1515
// CHECK: popq [[REGISTER:%[a-z]+]]
1616
// CHECK-NEXT: lfence
1717
// CHECK-NEXT: jmpq *[[REGISTER]]

tests/assembly/x86_64-fortanix-unknown-sgx-lvi-inline-assembly.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,25 @@ use std::arch::asm;
1010
pub extern "C" fn get(ptr: *const u64) -> u64 {
1111
let value: u64;
1212
unsafe {
13-
asm!(".start_inline_asm:",
14-
"mov {}, [{}]",
15-
".end_inline_asm:",
13+
asm!("mov {}, [{}]",
1614
out(reg) value,
1715
in(reg) ptr);
1816
}
1917
value
2018
}
2119

2220
// CHECK: get
23-
// CHECK: .start_inline_asm
24-
// CHECK-NEXT: movq
21+
// CHECK: movq
2522
// CHECK-NEXT: lfence
26-
// CHECK-NEXT: .end_inline_asm
2723

2824
#[no_mangle]
2925
pub extern "C" fn myret() {
3026
unsafe {
31-
asm!(
32-
".start_myret_inline_asm:",
33-
"ret",
34-
".end_myret_inline_asm:",
35-
);
27+
asm!("ret");
3628
}
3729
}
3830

3931
// CHECK: myret
40-
// CHECK: .start_myret_inline_asm
41-
// CHECK-NEXT: shlq $0, (%rsp)
32+
// CHECK: shlq $0, (%rsp)
4233
// CHECK-NEXT: lfence
4334
// CHECK-NEXT: retq

tests/assembly/x86_64-no-jump-tables.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// compile-flags: -O
77
// [set] compile-flags: -Zno-jump-tables
88
// only-x86_64
9+
// ignore-sgx
910

1011
#![crate_type = "lib"]
1112

tests/run-make/issue-36710/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# ignore-nvptx64-nvidia-cuda FIXME: can't find crate for `std`
55
# ignore-musl FIXME: this makefile needs teaching how to use a musl toolchain
66
# (see dist-i586-gnu-i586-i686-musl Dockerfile)
7+
# ignore-sgx
78

89
include ../../run-make-fulldeps/tools.mk
910

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
CHECK: cc_plus_one_asm
22
CHECK-NEXT: movl
33
CHECK-NEXT: lfence
4-
CHECK-NEXT: inc
5-
CHECK-NEXT: notq (%rsp)
6-
CHECK-NEXT: notq (%rsp)
4+
CHECK-NEXT: incl
5+
CHECK-NEXT: shlq $0, (%rsp)
76
CHECK-NEXT: lfence
87
CHECK-NEXT: retq
Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
CHECK: libunwind::Registers_x86_64::jumpto
1+
CHECK: __libunwind_Registers_x86_64_jumpto
22
CHECK: lfence
33
CHECK: lfence
44
CHECK: lfence
55
CHECK: lfence
6-
CHECK: shlq $0, (%rsp)
6+
CHECK: lfence
7+
CHECK: lfence
8+
CHECK: lfence
9+
CHECK: lfence
10+
CHECK: lfence
11+
CHECK: lfence
12+
CHECK: lfence
13+
CHECK: lfence
14+
CHECK: lfence
15+
CHECK: lfence
16+
CHECK: lfence
17+
CHECK: lfence
18+
CHECK: lfence
19+
CHECK: lfence
20+
CHECK-NEXT: popq [[REGISTER:%[a-z]+]]
21+
CHECK-NEXT: lfence
22+
CHECK-NEXT: popq [[REGISTER:%[a-z]+]]
723
CHECK-NEXT: lfence
8-
CHECK-NEXT: retq
24+
CHECK-NEXT: jmpq *[[REGISTER]]

tests/run-make/x86_64-fortanix-unknown-sgx-lvi/print.checks

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ CHECK: print
22
CHECK: lfence
33
CHECK: lfence
44
CHECK: lfence
5-
CHECK: popq
65
CHECK: callq 0x{{[[:xdigit:]]*}} <_Unwind_Resume>
76
CHECK-NEXT: ud2

0 commit comments

Comments
 (0)