openvmm: fuse: ReplySender::send_error panics on i32::MIN overflow in debug builds
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
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- rust
- Ambito
- operating-systems
Direzione di ricerca
Start at vm/devices/support/fs/fuse/src/reply.rs around line 42, in ReplySender::send_error, where make_header(unique, 0, -error) is built; read vm/devices/support/fs/fuse/src/session.rs around Session::dispatch to see how lx::Error::value() reaches it. Run cargo nextest run --profile agent -p fuse and use the named tests reply::tests::send_error_takes_any_code and session::tests::dispatch_replies_any_error_code as the finish line for an i32::MIN reply. The body references a fix.patch, so confirm whether that patch is already proposed before duplicating it.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
fuse::ReplySender::send_error negates its error: i32 argument with -error when populating fuse_out_header.error. Because -i32::MIN cannot be represented as an i32, passing i32::MIN triggers a signed negation overflow panic in builds with overflow checks enabled. Found by formal verification.
Root Cause
In vm/devices/support/fs/fuse/src/reply.rs#L37-L45, ReplySender::send_error accepts any i32 error code and negates it directly with -error on reply.rs#L42:
/// Send an error reply.
fn send_error(&mut self, unique: u64, error: i32) -> io::Result<()> {
if error != 0 {
tracing::debug!(unique, error, "reply");
}
let header = make_header(unique, 0, -error);
let header = header.as_bytes();
self.send(&[io::IoSlice::new(header)])
}
lx::Error wraps an arbitrary i32 via lx::Error::from_lx, and Session::dispatch forwards e.value() directly to sender.send_error(unique, e.value()) in vm/devices/support/fs/fuse/src/session.rs#L90-L98 without restricting the range of i32 values.
Consequence
If ReplySender::send_error is called with i32::MIN—either directly or through Session::dispatch when a Fuse implementation returns Err(lx::Error::from_lx(i32::MIN))—builds with integer overflow checks enabled (such as dev builds, where panic = 'abort' is configured) panic with attempt to negate with overflow and abort the process. Release builds without overflow checks already wrap -i32::MIN to i32::MIN. This path is not reachable in practice through VirtioFs, whose errors originate from positive lx errno constants and host OS error codes mapped by lxutil.
Reproduction
Call sender.send_error(1, i32::MIN) on any ReplySender, or initialize a fuse::Session around a Fuse implementation whose get_attr returns Err(lx::Error::from_lx(i32::MIN)) and dispatch a FUSE_GETATTR request.
The regression tests reply::tests::send_error_takes_any_code and session::tests::dispatch_replies_any_error_code in fix.patch exercise both paths via cargo nextest run --profile agent -p fuse. Before the fix, both tests fail with a panic (attempt to negate with overflow at vm/devices/support/fs/fuse/src/reply.rs:42:45); after the fix, both pass and emit an error reply header with error = i32::MIN (i32::MIN.wrapping_neg()).
Related: #1629, #1628, #1631, #1630.
- 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