Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dc4236d

Browse files
Rollup merge of rust-lang#123024 - maurer:kcfi-testing, r=workingjubilee
CFI: Enable KCFI testing of run-pass tests This enables KCFI-based testing for all the CFI run-pass tests in the suite today. We can add the test header on top of in-flight CFI tests once they land. This is becoming more important as we get closer to leveraging CFI's multiple type attachment feature, as that is where the implementations will have a divergence. It also enables KCFI as a sanitizer for x86_64 and aarch64 Linux to make this possible. The sanitizer should likely be available for all aarch64, x86_64, and riscv targets, but that isn't critical for initial testing.
2 parents bffeb05 + 2c0a8de commit dc4236d

File tree

7 files changed

+31
-12
lines changed

7 files changed

+31
-12
lines changed

‎compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_gnu.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn target() -> Target {
1919
stack_probes: StackProbeType::Inline,
2020
supported_sanitizers: SanitizerSet::ADDRESS
2121
| SanitizerSet::CFI
22+
| SanitizerSet::KCFI
2223
| SanitizerSet::LEAK
2324
| SanitizerSet::MEMORY
2425
| SanitizerSet::MEMTAG

‎compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_gnu.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub fn target() -> Target {
1010
base.static_position_independent_executables = true;
1111
base.supported_sanitizers = SanitizerSet::ADDRESS
1212
| SanitizerSet::CFI
13+
| SanitizerSet::KCFI
1314
| SanitizerSet::DATAFLOW
1415
| SanitizerSet::LEAK
1516
| SanitizerSet::MEMORY

‎src/tools/compiletest/src/header.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
827827
"needs-sanitizer-cfi",
828828
"needs-sanitizer-dataflow",
829829
"needs-sanitizer-hwaddress",
830+
"needs-sanitizer-kcfi",
830831
"needs-sanitizer-leak",
831832
"needs-sanitizer-memory",
832833
"needs-sanitizer-memtag",

‎tests/ui/sanitizer/cfi-closure-fn-ptr-cast.rs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,15 @@
55
//
66
// This checks that the reified function pointer will have the expected alias set at its call-site.
77

8-
//@ needs-sanitizer-cfi
8+
//@ revisions: cfi kcfi
99
// FIXME(#122848) Remove only-linux once OSX CFI binaries work
1010
//@ only-linux
11-
//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi
12-
//@ compile-flags: -C target-feature=-crt-static -C codegen-units=1 -C opt-level=0
11+
//@ [cfi] needs-sanitizer-cfi
12+
//@ [kcfi] needs-sanitizer-kcfi
13+
//@ compile-flags: -C target-feature=-crt-static
14+
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
15+
//@ [cfi] compile-flags: -Z sanitizer=cfi
16+
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
1317
//@ run-pass
1418

1519
pub fn main() {

‎tests/ui/sanitizer/cfi-complex-receiver.rs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
// * Arc<dyn Foo> as for custom receivers
33
// * &dyn Bar<T=Baz> for type constraints
44

5-
//@ needs-sanitizer-cfi
5+
//@ revisions: cfi kcfi
66
// FIXME(#122848) Remove only-linux once OSX CFI binaries work
77
//@ only-linux
8-
//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi
9-
//@ compile-flags: -C target-feature=-crt-static -C codegen-units=1 -C opt-level=0
8+
//@ [cfi] needs-sanitizer-cfi
9+
//@ [kcfi] needs-sanitizer-kcfi
10+
//@ compile-flags: -C target-feature=-crt-static
11+
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
12+
//@ [cfi] compile-flags: -Z sanitizer=cfi
13+
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
1014
//@ run-pass
1115

1216
use std::sync::Arc;

‎tests/ui/sanitizer/cfi-self-ref.rs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
// Check that encoding self-referential types works with #[repr(transparent)]
22

3-
//@ needs-sanitizer-cfi
3+
//@ revisions: cfi kcfi
44
// FIXME(#122848) Remove only-linux once OSX CFI binaries work
55
//@ only-linux
6-
//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi
7-
//@ compile-flags: -C target-feature=-crt-static -C codegen-units=1 -C opt-level=0
6+
//@ [cfi] needs-sanitizer-cfi
7+
//@ [kcfi] needs-sanitizer-kcfi
8+
//@ compile-flags: -C target-feature=-crt-static
9+
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
10+
//@ [cfi] compile-flags: -Z sanitizer=cfi
11+
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
812
//@ run-pass
913

1014
use std::marker::PhantomData;

‎tests/ui/sanitizer/cfi-virtual-auto.rs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
// Tests that calling a trait object method on a trait object with additional auto traits works.
22

3-
//@ needs-sanitizer-cfi
3+
//@ revisions: cfi kcfi
44
// FIXME(#122848) Remove only-linux once OSX CFI binaries work
55
//@ only-linux
6-
//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi
7-
//@ compile-flags: -C target-feature=-crt-static -C codegen-units=1 -C opt-level=0
6+
//@ [cfi] needs-sanitizer-cfi
7+
//@ [kcfi] needs-sanitizer-kcfi
8+
//@ compile-flags: -C target-feature=-crt-static
9+
//@ [cfi] compile-flags: -C codegen-units=1 -C lto -C prefer-dynamic=off -C opt-level=0
10+
//@ [cfi] compile-flags: -Z sanitizer=cfi
11+
//@ [kcfi] compile-flags: -Z sanitizer=kcfi
812
//@ run-pass
913

1014
trait Foo {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /