Skip to content
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

Fix LVI tests after frame pointers are enabled by default #121683

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

raoulstrackx
Copy link
Contributor

#121203 enables frame pointers by default. This affects LVI mitigations for the x86_64-fortanix-unknown-sgx target. LVI remained mitigated correctly, but the tests were too strict.

@nshyrei , @jethrogb

@rustbot
Copy link
Collaborator

rustbot commented Feb 27, 2024

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 27, 2024
@raoulstrackx
Copy link
Contributor Author

r? @cuviper since you reviewed some (all?) of these LVI tests. Could you take a look?

@rustbot rustbot assigned cuviper and unassigned Mark-Simulacrum Feb 28, 2024
@cuviper
Copy link
Member

cuviper commented Feb 28, 2024

I can take this one, but I don't really want to be the "LVI" guy in general, rather let the review rotation spread it out.

Note that the global default for rust.frame-pointers is false, but it is enabled specifically in the "codegen" and "compiler" profiles, meant for developer use. Will your changes still work with FP disabled?

@rust-log-analyzer

This comment has been minimized.

@raoulstrackx
Copy link
Contributor Author

Note that the global default for rust.frame-pointers is false, but it is enabled specifically in the "codegen" and "compiler" profiles, meant for developer use. Will your changes still work with FP disabled?

Good catch! I've updated the test. Unfortunately, I didn't find a way to express that we're only interested in the last popq instruction. I think the FileCheck grammer is too limited to express this.

@raoulstrackx
Copy link
Contributor Author

Note that the global default for rust.frame-pointers is false, but it is enabled specifically in the "codegen" and "compiler" profiles, meant for developer use.

On a related note: what's the config of the nightly compilers being build?

@cuviper
Copy link
Member

cuviper commented Mar 1, 2024

On a related note: what's the config of the nightly compilers being build?

CI builds don't use any of the bootstrap profiles, just a heap of ./configure arguments. Since none of them are currently changing this setting, it will remain disabled.

Comment on lines 52 to 53
check 'std::io::stdio::_print::[[:alnum:]] ' print.with_frame_pointes.checks ||
check 'std::io::stdio::_print::[[:alnum:]] ' print.without_frame_pointes.checks
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
check 'std::io::stdio::_print::[[:alnum:]] ' print.with_frame_pointes.checks ||
check 'std::io::stdio::_print::[[:alnum:]] ' print.without_frame_pointes.checks
check 'std::io::stdio::_print::[[:alnum:]] ' print.with_frame_pointers.checks ||
check 'std::io::stdio::_print::[[:alnum:]] ' print.without_frame_pointers.checks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good catch! I was under the impression that the script would fail if if referenced a file that didn't exist. There's the set -e option at line 2, but that doesn't work well with sh. I already filed #121685 last week to clean up this script. It also changes the shell to bash. I've only updated the filenames here.

@cuviper
Copy link
Member

cuviper commented Mar 4, 2024

@bors r rollup

@bors
Copy link
Contributor

bors commented Mar 4, 2024

📌 Commit ede25ad has been approved by cuviper

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 4, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 4, 2024
Fix LVI tests after frame pointers are enabled by default

rust-lang#121203 enables frame pointers by default. This affects LVI mitigations for the `x86_64-fortanix-unknown-sgx` target. LVI remained mitigated correctly, but the tests were too strict.

`@nshyrei` , `@jethrogb`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 4, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#120976 (constify a couple thread_local statics)
 - rust-lang#121683 (Fix LVI tests after frame pointers are enabled by default)
 - rust-lang#121703 (Add a way to add constructors for `rustc_type_ir` types)
 - rust-lang#121732 (Improve assert_matches! documentation)
 - rust-lang#121928 (Extract an arguments struct for `Builder::then_else_break`)
 - rust-lang#121939 (Small enhancement to description of From trait)
 - rust-lang#121968 (Don't run test_get_os_named_thread on win7)
 - rust-lang#121969 (`ParseSess` cleanups)
 - rust-lang#121977 (Doc: Fix incorrect reference to integer in Atomic{Ptr,Bool}::as_ptr.)
 - rust-lang#121994 (Update platform-support.md with supported musl version)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 4, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#120976 (constify a couple thread_local statics)
 - rust-lang#121683 (Fix LVI tests after frame pointers are enabled by default)
 - rust-lang#121703 (Add a way to add constructors for `rustc_type_ir` types)
 - rust-lang#121732 (Improve assert_matches! documentation)
 - rust-lang#121928 (Extract an arguments struct for `Builder::then_else_break`)
 - rust-lang#121939 (Small enhancement to description of From trait)
 - rust-lang#121968 (Don't run test_get_os_named_thread on win7)
 - rust-lang#121969 (`ParseSess` cleanups)
 - rust-lang#121977 (Doc: Fix incorrect reference to integer in Atomic{Ptr,Bool}::as_ptr.)
 - rust-lang#121994 (Update platform-support.md with supported musl version)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8886c31 into rust-lang:master Mar 5, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 5, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 5, 2024
Rollup merge of rust-lang#121683 - fortanix:raoul/lvi_fixes, r=cuviper

Fix LVI tests after frame pointers are enabled by default

rust-lang#121203 enables frame pointers by default. This affects LVI mitigations for the `x86_64-fortanix-unknown-sgx` target. LVI remained mitigated correctly, but the tests were too strict.

``@nshyrei`` , ``@jethrogb``
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 9, 2024
…est_script, r=Mark-Simulacrum

Fixing shellcheck comments on lvi test script

Running `shellcheck` on `tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh` gives plenty of warnings. This PR fixes those issues. For completeness: rust-lang#121683 fixes another warning as well
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Mar 10, 2024
…est_script, r=Mark-Simulacrum

Fixing shellcheck comments on lvi test script

Running `shellcheck` on `tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh` gives plenty of warnings. This PR fixes those issues. For completeness: rust-lang#121683 fixes another warning as well
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 10, 2024
…est_script, r=Mark-Simulacrum

Fixing shellcheck comments on lvi test script

Running `shellcheck` on `tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh` gives plenty of warnings. This PR fixes those issues. For completeness: rust-lang#121683 fixes another warning as well
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 10, 2024
…est_script, r=Mark-Simulacrum

Fixing shellcheck comments on lvi test script

Running `shellcheck` on `tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh` gives plenty of warnings. This PR fixes those issues. For completeness: rust-lang#121683 fixes another warning as well
jhpratt added a commit to jhpratt/rust that referenced this pull request Mar 10, 2024
…est_script, r=Mark-Simulacrum

Fixing shellcheck comments on lvi test script

Running `shellcheck` on `tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh` gives plenty of warnings. This PR fixes those issues. For completeness: rust-lang#121683 fixes another warning as well
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 10, 2024
…est_script, r=Mark-Simulacrum

Fixing shellcheck comments on lvi test script

Running `shellcheck` on `tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh` gives plenty of warnings. This PR fixes those issues. For completeness: rust-lang#121683 fixes another warning as well
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 10, 2024
Rollup merge of rust-lang#121685 - fortanix:raoul/shellcheck_on_lvi_test_script, r=Mark-Simulacrum

Fixing shellcheck comments on lvi test script

Running `shellcheck` on `tests/run-make/x86_64-fortanix-unknown-sgx-lvi/script.sh` gives plenty of warnings. This PR fixes those issues. For completeness: rust-lang#121683 fixes another warning as well
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants