rust-lang / rust-lang/rust

`-Crelocation-model=rwpi` (and possibly others) are unsound due to affecting the ABI

Open
#131,300 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-unsound O-AArch64 O-Arm P-medium
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

This is based on the discussion here; I don't understand much of the underlying technical details unfortunately.

It seems like setting -Crelocation-model=rwpi on an ARM target compiles code in a way that it expects a particular register to be reserved for data addressing. However, the standard library is not built with that in mind and can use the register for other purposes. That's clearly unsound, we can now get arbitrary misbehavior because the same register is used in conflicting ways.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Zulip discussion and the compiler handling for -Crelocation-model=rwpi on ARM targets. Trace how the reserved register assumption interacts with standard-library builds and the ABI. Done means the unsound configuration is resolved or rejected, with regression coverage for the conflicting register usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.