openvmm: virtiofs: aggregate synthetic root returns empty EOF reply instead of EINVAL when buffer fits no entry
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 74/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- operating-systems
Direzione di ricerca
Inizia in vm/devices/virtio/virtiofs/src/aggregate.rs presso read_synthetic_root_dir_with (intorno a L314-L366); segui il ciclo che si interrompe su !fit e restituisce Ok(buffer). Confronta con la gestione di EINVAL in VirtioFsFile::read_dir_with (src/file.rs, ~L236-L238) e read_dir_microvm (src/microvm/file.rs, ~L83-L85) per allinearti alla convenzione esistente sugli errori. Fatto significa che un buffer vuoto con voci ancora in sospeso restituisce Err(lx::Error::EINVAL) sia per READDIR sia per READDIRPLUS, con test unitari che usano i passaggi di riproduzione (dimensione 31 / 159 e il caso di continuazione con offset 2).
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
When a guest issues FUSE_READDIR or FUSE_READDIRPLUS on an aggregate mount's synthetic root directory with a non-zero buffer size too small to hold the next directory entry, VirtioFs::read_synthetic_root_dir_with returns Ok(Vec::new()) instead of Err(lx::Error::EINVAL). Because FUSE defines an empty directory read reply as end-of-directory, the guest truncates the synthetic root's directory listing instead of receiving EINVAL. Found by testing.
Root Cause
In vm/devices/virtio/virtiofs/src/aggregate.rs#L314-L366, VirtioFs::read_synthetic_root_dir_with breaks out of the entry-serialization loop as soon as write_synthetic_dot or write_child_entry reports !fit, and unconditionally returns Ok(buffer) even when buffer is still empty:
if !fit {
break;
}
index = next;
}
Ok(buffer)
For example, a plain FUSE_READDIR entry for . requires fuse_dirent_align(size_of::<fuse_dirent>() + 1) = 32 bytes (fuse_direntplus requires 160 bytes), so any size in 1..=31 (1..=159 for FUSE_READDIRPLUS), or any continuation read whose size cannot hold the aligned entry of the next child share name, causes !fit on the first attempted entry and returns a 0-byte buffer. By contrast, real share directories reject undersized buffers that have remaining entries but fit none with EINVAL in both VirtioFsFile::read_dir_with and VirtioFsFile::read_dir_microvm.
Consequence
FUSE and getdents64 treat a 0-byte FUSE_READDIR / FUSE_READDIRPLUS reply as end-of-directory rather than a short-buffer error. A caller supplying a small buffer at offset 0 sees an empty root directory, and a caller whose continuation buffer fits . and .. (64 bytes) or short share names before hitting a longer share name receives a silent early EOF that hides the remaining shares instead of failing with EINVAL as Linux getdents64 and regular share directories do.
Reproduction
- Construct an aggregate
VirtioFsviaVirtioFs::new_microvm_aggregatewith at least one child share (for example"work"). - Open the synthetic root directory via
Fuse::open_dir(&fs, &request(FUSE_ROOT_ID), lx::O_RDONLY as u32). - Call
Fuse::read_diratoffset = 0withsize = 31(orFuse::read_dir_pluswithsize = 159), or first read.and..withsize = 64(next_cookie = 2) and then callFuse::read_diratoffset = 2withsize = 31. - Observe
Ok(vec![])instead ofErr(lx::Error::EINVAL).
Related: #1598, #1632, #1624.
- Lingua principale
- Rust
- Stelle
- 848
- Fork
- 63
- Merge medio
- 13h 37m
- PR unite (30g)
- 571
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/nvx
-
area: ci
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
area: ci
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
openvmm: virtiofs: aggregate synthetic root st_nlink counts single-file shares as subdirectoriesApertaarea: openvmm
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
microsoft/nvx#1632 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area: openvmm
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
microsoft/nvx#1628 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
area: openvmm
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
microsoft/nvx#1629 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/nvx
Issue simili
-
priority: low
Difficoltà 1/5 1-3 ore Idoneità per principianti 83/100
storytold/vectorcraft#8387 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
area:desktop kind:test priority:p3 ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 91/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
obi1kenobi/cargo-semver-checks#1814 ·
I maintainer di solito rispondono entro 1 giorno
-
COMPARE.md symlink is brokenAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
BurntSushi/jiff#715 ·
I maintainer di solito rispondono entro 1 giorno