-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Migrate branch-protection-check-IBT
to rmake.rs
#134760
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bors
merged 1 commit into
rust-lang:master
from
jieyouxu:enable-branch-protection-check-IBT
Dec 28, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
fn main() { | ||
println!("hello world"); | ||
} | ||
#![feature(no_core)] | ||
#![allow(internal_features)] | ||
#![no_core] | ||
#![no_std] | ||
#![no_main] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// ignore-tidy-linelength | ||
//! A basic smoke test to check for GNU Property Note to see that for `x86_64` targets when [`-Z | ||
//! cf-protection=branch`][intel-cet-tracking-issue] is requested, that the | ||
//! | ||
//! ```text | ||
//! NT_GNU_PROPERTY_TYPE_0 Properties: x86 feature: IBT | ||
//! ``` | ||
//! | ||
//! Intel Indirect Branch Tracking (IBT) property is emitted. This was generated in | ||
//! <https://github.com/rust-lang/rust/pull/110304> in order to address | ||
//! <https://github.com/rust-lang/rust/issues/103001>. | ||
//! | ||
//! Note that the precompiled std currently is not compiled with `-Z cf-protection=branch`! | ||
//! | ||
//! In particular, it is expected that: | ||
//! | ||
//! > IBT to only be enabled for the process if `.note.gnu.property` indicates that the executable | ||
//! > was compiled with IBT support and the linker to only tell that IBT is supported if all input | ||
//! > object files indicate that they support IBT, which in turn requires the standard library to be | ||
//! > compiled with IBT enabled. | ||
//! | ||
//! Note that Intel IBT (Indirect Branch Tracking) is not to be confused with Arm's BTI (Branch | ||
//! Target Identification). See below for link to Intel IBT docs. | ||
//! | ||
//! ## Related links | ||
//! | ||
//! - [Tracking Issue for Intel Control Enforcement Technology (CET)][intel-cet-tracking-issue] | ||
//! - Zulip question about this test: | ||
//! <https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20Branch.20protection.20and.20.60.2Enote.2Egnu.2Eproperty.60> | ||
//! - Intel IBT docs: | ||
//! <https://edc.intel.com/content/www/us/en/design/ipla/software-development-platforms/client/platforms/alder-lake-desktop/12th-generation-intel-core-processors-datasheet-volume-1-of-2/006/indirect-branch-tracking/> | ||
//! | ||
//! [intel-cet-tracking-issue]: https://github.com/rust-lang/rust/issues/93754 | ||
|
||
//@ needs-llvm-components: x86 | ||
|
||
// FIXME(#93754): increase the test coverage of this test. | ||
//@ only-x86_64-unknown-linux-gnu | ||
//@ ignore-cross-compile | ||
|
||
use run_make_support::{bare_rustc, llvm_readobj}; | ||
|
||
fn main() { | ||
// `main.rs` is `#![no_std]` to not pull in the currently not-compiled-with-IBT precompiled std. | ||
bare_rustc() | ||
.input("main.rs") | ||
.target("x86_64-unknown-linux-gnu") | ||
.arg("-Zcf-protection=branch") | ||
.arg("-Clink-args=-nostartfiles") | ||
.run(); | ||
|
||
llvm_readobj().arg("-nW").input("main").run().assert_stdout_contains(".note.gnu.property"); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.