[axi_sram] a partialy written capability can still be stored as valid

Aperta
#778 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva

Direzione di ricerca

Start with the block DV test axi_sram_wuser_partial_strobe using the provided dvsim command, then read axi_to_detailed_mem.sv around line 414 and the vendor patch 0004_Add_CHERI_support_to_axi_to_mem.patch. Check how byte enables affect cheri_w_tag; done when the partial-strobe test confirms the tag is not set and the vendored file has been regenerated from the patch.

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

Descrizione

A capability is stored in a 128-bit aligned region, written as two 64-bit beats, and each region has one tag bit that marks it as a valid capability. doc/ref/arch.md (8rlwol, 893tz4) says the tag may only be set when the whole 16 bytes are written, and that any partial write must clear it.

The SRAM decides whether to set the tag from three things: the request's tag bit, the transfer's shape (two 8-byte beats) and its alignment. It ignores the byte-enables, which say which bytes of a beat are actually written. So a correctly shaped write with the tag bit set, but with only some bytes enabled on either beat, still sets the tag. The slot then holds a capability marked valid whose bytes are part new data and part old memory contents, which software could use to forge a capability.

This scenario is captured in the block DV environment, and can be ran with:

dvsim hw/top_chip/dv/axi_sram/block_tb/axi_sram_block_sim_cfg.hjson -i axi_sram_wuser_partial_strobe

This test does a 2 beat aligned write with the tag bit set and only 4 of 8 bytes enabled. The tag is stored, and TagSetNeedsFullStrobe_A fires.

Proposed fix: only set the tag when every byte-enable on the beat is set. This means adding & (&axi_req_i.w.strb) to cheri_w_tag in axi_to_detailed_mem.sv (around line 414). The CHERI logic comes from the vendor patch 0004_Add_CHERI_support_to_axi_to_mem.patch, so the change goes in that patch and the vendored file is regenerated, not hand-edited.

Lingua principale
SystemVerilog
Stelle
45
Fork
22
Merge medio
2g 4h
PR unite (30g)
9

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 lowRISC/mocha

Tutte le issue di lowRISC/mocha

Issue simili

Altre issue su Embedded & IoT

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.