What are the opsem effects of CHERI?

Aperta
#625 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
compilers

Direzione di ricerca

The issue asks for a concise summary of CHERI's operational semantics effects on Rust. Start by reading the linked Zulip/IRLO discussions and the CHERIoT limitations comment. Understand how usize being 64-bit changes pointer operations like with_exposed_provenance, int as ptr, and wrapping_offset. The goal is to document when programs might safely abort and the implications for unsafe code guidelines.

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

Descrizione

We discussed this on Zulip multiple times and maybe even on IRLO but I could not find a concise summary. This assume that on CHERI, usize is 64bit -- discussion of other ways choices should be delegated to other threads.

So what operations work different on CHERI than they would on all other Rust targets?

  • with_exposed_provenance/int as ptr simply does not work. We should probably reject it at compile time; if we don't then the operation will create a no-capability pointer and the program will (safely) abort at runtime when that pointer is used to access memory.
  • wrapping_offset may sometimes "lose" the capability. Due to CHERI compressing capabilities into 64bit, they cannot precisely represent capabilities that are too far away from the address the pointer is pointing to, so something like ptr.wrapping_add(BIG).wrapping_sub(BIG) might break the pointer. The program will safely abort at runtime when such a pointer is used to access memory. This can also affect operations based on wrapping_offset, such as with_addr.
  • Copying a pointer byte-for-byte with MaybeUninit<u8> (or similar) no longer works: the copy may lose its permissions, using it to access memory will (safely) abort the process.
  • CHERIoT has some more concerning limitations: pointers to stack variables cannot be stored in global variables or the heap.

I think that's it? Basically we get some safe aborts in cases where the program should not abort, but that should hopefully be rare and if it happens, it shouldn't be too hard to debug.

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.