openvmm: fuse: data reply exceeding requested size panics in Session::send_max_size
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 80/100
Línea de trabajo
Empieza en vm/devices/support/fs/fuse/src/session.rs, especialmente en Session::send_max_size alrededor de la línea 567, y luego sigue sus llamadores Read, GetXAttr, ListXAttr, ReadDir y ReadDirPlus en dispatch_helper; compara la ruta de Ioctl que devuelve EINVAL. El trait público Fuse está en vm/devices/support/fs/fuse/src/lib.rs, y el issue nombra la prueba de regresión dispatch_read_reply_larger_than_size_fails (en fix.patch), ejecutable con el comando cargo nextest indicado. Hecho significa que una respuesta sobredimensionada produce una respuesta de error como -EIO en lugar de abortar el VMM.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary
fuse::Session::send_max_size enforces with assert!(data.len() <= max_size as usize) that a filesystem's data reply does not exceed the guest-requested byte count. Because both dev and release profiles configure panic = 'abort', any fuse::Fuse implementation that returns more bytes than requested in read, read_dir, read_dir_plus, get_xattr, or list_xattr aborts the entire VMM process instead of failing the FUSE request with an error reply. Found by formal verification.
Root Cause
In vm/devices/support/fs/fuse/src/session.rs, Session::send_max_size uses an unconditional assert! to validate the length of the Vec<u8> returned by the Fuse trait implementation against the guest's max_size: u32:
/// Send a reply, validating it doesn't exceed the requested size.
///
/// If it exceeds the maximum size, this causes a panic because that's a bug in the file system.
fn send_max_size(
sender: &mut impl ReplySender,
unique: u64,
data: &[u8],
max_size: u32,
) -> Result<(), OperationError> {
assert!(data.len() <= max_size as usize);
sender.send_data(unique, data)?;
Ok(())
}
Session::dispatch_helper calls Self::send_max_size for Read (L204-L207), GetXAttr (L245-L247), ListXAttr (L260-L262), ReadDir (L280-L283), and ReadDirPlus (L373-L376). Meanwhile, the corresponding public Fuse trait methods return lx::Result<Vec<u8>> without documenting or enforcing an upper bound in the return type, whereas FuseOperation::Ioctl in the same dispatcher (L334-L336) already rejects an oversized buffer gracefully with Err(lx::Error::EINVAL.into()).
Consequence
OpenVMM sets panic = 'abort' in both [profile.dev] and [profile.release] (Cargo.toml). If a custom or future fuse::Fuse backend passed to fuse::Session::new or virtiofs::VirtioFsDevice::new returns a payload even one byte larger than arg.size, the session dispatcher aborts the entire VMM process rather than failing the offending FUSE request. OpenVMM's built-in VirtioFs backend sizes its read, xattr, and directory buffers from the guest's size parameter and does not trigger this panic, making this a fuse::Session API hardening issue.
Reproduction
Implement fuse::Fuse with read returning Ok(vec![0; arg.size as usize + 1]), initialize a fuse::Session with FUSE_INIT, and dispatch a FUSE_READ request with size = 4096. On commit 9d64daad3cbe14fb0591081b73c6c9648e18d0fb, dispatching the request panics at vm/devices/support/fs/fuse/src/session.rs:576:9 with assertion failed: data.len() <= max_size as usize. Running cargo nextest run --profile agent -p fuse -E 'test(dispatch_read_reply_larger_than_size_fails)' with the regression test in fix.patch reproduces the panic prior to the fix and passes with a -EIO reply afterward.
Related: #1628, #1631, #1630, #1625.
- Lenguaje dominante
- Rust
- Estrellas
- 848
- Forks
- 63
- Merge medio
- 13 h 37 min
- PR fusionados (30 d)
- 571
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/nvx
-
area: ci
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
area: ci
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 1 día
-
openvmm: virtiofs: aggregate synthetic root st_nlink counts single-file shares as subdirectoriesAbiertoarea: openvmm
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
microsoft/nvx#1632 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area: openvmm
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/nvx#1628 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area: openvmm
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
microsoft/nvx#1631 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/nvx
Issues similares
-
priority: low
Dificultad 1/5 1-3 horas Aptitud para principiantes 83/100
storytold/vectorcraft#8387 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
area:desktop kind:test priority:p3 ready
Dificultad 2/5 1-3 horas Aptitud para principiantes 91/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
obi1kenobi/cargo-semver-checks#1814 ·
Los mantenedores suelen responder en 1 día
-
COMPARE.md symlink is brokenAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
BurntSushi/jiff#715 ·
Los mantenedores suelen responder en 1 día