rust-lang / rust-lang/rust

Allow CFI with crt-static

Open
#155,269 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-sanitizers needs-triage
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I am working on enabling CFI on the Trusty OS. After adding "supported-sanitizers": ["cfi"], to a custom copy of aarch64-unknown-trusty I also needed to set "crt-static-default": false. Otherwise I would get an error about sanitizers being incompatible with static linking.

With the two target changes, CFI is working as intended on Trusty.

The check and error were introduced to fix https://github.com/rust-lang/rust/issues/85459, and the issue specifically mentions Linux. Could the check be relaxed to allow CFI (and maybe other sanitizers) together with crt-static outside of Linux?

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

Read the sanitizer and static-linking compatibility check introduced for issue #85459, then compare its Linux-specific rationale with the custom aarch64-unknown-trusty target settings described here. Reproduce the configuration with supported-sanitizers set to cfi and crt-static-default set to false; done means CFI and crt-static work together outside Linux without weakening the existing Linux restriction.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.