Skip to content

Taint body on invalid call ABI #142983

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
merged 2 commits into from
Jun 25, 2025

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Jun 24, 2025

Fixes #142969

I'm not certain if there are any other paths that should be tainted, but they would operate similarly. Perhaps pointer coercion.

Introduces extern "rust-invalid" for testing purposes.

r? @workingjubilee or @oli-obk (or anyone)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 24, 2025
@workingjubilee
Copy link
Member

I believe we can coerce a function pointer from unsafe extern "abi" fn(A) -> R to extern "abi" fn(A) -> R.

@compiler-errors
Copy link
Member Author

I believe we can coerce a function pointer from unsafe extern "abi" fn(A) -> R to extern "abi" fn(A) -> R.

Yeah, but IDK if it causes an ICE in CTFE and therefore deserves tainting like this.

@compiler-errors compiler-errors force-pushed the taint-invalid-call-abi branch from ddaee78 to 61e8d05 Compare June 24, 2025 22:34
@rustbot
Copy link
Collaborator

rustbot commented Jun 24, 2025

These commits modify compiler targets.
(See the Target Tier Policy.)

@compiler-errors
Copy link
Member Author

Added extern "rust-invalid" in the first commit, and (manually...) checked that it still ICEd in the same way as extern "cmse-*". Then I fixed the ICE in the second commit.

@workingjubilee
Copy link
Member

neat!

@compiler-errors
Copy link
Member Author

compiler-errors commented Jun 24, 2025

For the record, the ExternAbi/CanonAbi split meant it was so easy to add rust-invalid convention b/c I didn't have to add new match arms for a theoretical CanonAbi::RustInvalid (which far outnumber the matches on ExternAbi) b/c the whole point is that it cannot ever be canonized lol.

Copy link
Member

@workingjubilee workingjubilee left a comment

Choose a reason for hiding this comment

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

r=me with the apparent duplication sorted or explained

@workingjubilee
Copy link
Member

wonderful! I'm glad that my opinions on the architecture are paying off here.

@compiler-errors compiler-errors force-pushed the taint-invalid-call-abi branch from 61e8d05 to e776065 Compare June 24, 2025 22:43
@workingjubilee
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Jun 25, 2025

📌 Commit e776065 has been approved by workingjubilee

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 Jun 25, 2025
bors added a commit that referenced this pull request Jun 25, 2025
Rollup of 15 pull requests

Successful merges:

 - #135731 (Implement parsing of pinned borrows)
 - #138780 (Add `#[loop_match]` for improved DFA codegen)
 - #142453 (Windows: make `read_dir` stop iterating after the first error is encountered)
 - #142633 (Error on invalid signatures for interrupt ABIs)
 - #142768 (Avoid a bitcast FFI call in transmuting)
 - #142825 (Port `#[track_caller]` to the new attribute system)
 - #142844 (Enable short-ice for Windows)
 - #142934 (Tweak `-Zmacro-stats` measurement.)
 - #142955 (Couple of test suite fixes for cg_clif)
 - #142977 (rustdoc: Don't mark `#[target_feature]` functions as ⚠)
 - #142980 (Reduce mismatched-lifetime-syntaxes suggestions to MaybeIncorrect)
 - #142982 (Corrected spelling mistake in c_str.rs)
 - #142983 (Taint body on invalid call ABI)
 - #142988 (Update wasm-component-ld to 0.5.14)
 - #142993 (Update cargo)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0f77e83 into rust-lang:master Jun 25, 2025
10 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jun 25, 2025
rust-timer added a commit that referenced this pull request Jun 25, 2025
Rollup merge of #142983 - compiler-errors:taint-invalid-call-abi, r=workingjubilee

Taint body on invalid call ABI

Fixes #142969

I'm not certain if there are any other paths that should be tainted, but they would operate similarly. Perhaps pointer coercion.

Introduces `extern "rust-invalid"` for testing purposes.

r? ```@workingjubilee``` or ```@oli-obk``` (or anyone)
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE None abi map
4 participants