We have a semantically relevant inlining pass?

Aperta
#597 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
20/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
compilers

Direzione di ricerca

Start with the linked rust-lang/rust pull request 134082 and this issue's discussion of mir-opt-level=0, MIR transforms, drop elaboration, and rustc_force_inline. Determine which transforms remain enabled and whether the inlining behavior changes the documented opsem or UB model; done requires an agreed policy for future MIR transforms and their documentation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I was just made aware of https://github.com/rust-lang/rust/pull/134082, which is a concerning PR: it seems to add an inlining pass that cannot be disabled. This is something that should have involved t-opsem and maybe even t-lang since it affects which code has UB.

I don't think we should have any MIR transforms that remain enabled under mir-opt-level=0, except for the ones that transform the MIR from one dialect to another -- at the moment, that should be drop elaboration and nothing else. Every such MIR transform is semantically relevant and needs to be accounted for in the documentation of what is and is not UB.

For the concrete example of inlining, https://github.com/rust-lang/rust/pull/134082 had the side-effect of removing UB related to violating the Stacked Borrows protectors of references passed to force-inline functions. Was it an intended part of the PR to remove such UB? I assume not, since surely someone would have pinged t-opsem. So please take this into account for future work on MIR transforms: everything that can't be turned off becomes part of the opsem!

And then the next question is -- why is it so important that these functions be inlined that we have to adjust the opsem to make it happen? I found no use of rustc_force_inline in the standard library. The PR mentions ROP gadgets for pointer authentication instructions; those are AFAIK concerns that live outside the opsem so they should be resolved in a way that does not impact the opsem or Miri.

Cc @saethlin @davidtwco

Lingua principale
Nessun dato sulla lingua
Stelle
760
Fork
68
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-lang/unsafe-code-guidelines

Tutte le issue di rust-lang/unsafe-code-guidelines

Issue simili

Altre issue su Compilers

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.