Skip to content

Commit ec4f30d

Browse files
committed
vmm: migration: abort receive on unexpected EOF while receiving memory
This cherry-pick is needed as the new approach doesn't send the Request::abandon() anymore. If the sender closes the connection while the receiver is reading memory, e.g. after a canceled migration, read_volatile_from() returns Ok(0). The receive loop treated this as a zero-progress read and spun forever, leaving receive-migration (and thus the destination VMM's API) hanging indefinitely. Found by the migration cancellation integration tests. On-behalf-of: SAP philipp.schuster@sap.com Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
1 parent 9737f0a commit ec4f30d

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎vmm/src/migration/transport.rs‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,13 @@ pub(crate) fn receive_memory_ranges(
11671167
"Error receiving memory from socket: {e}"
11681168
))
11691169
})?;
1170+
1171+
// EOF: Don't spin forever on closed connection
1172+
if bytes_read == 0 {
1173+
return Err(MigratableError::MigrateReceive(anyhow!(
1174+
"Connection closed while receiving memory: EOF"
1175+
)));
1176+
}
11701177
offset += bytes_read as u64;
11711178

11721179
if offset == range.length {

0 commit comments

Comments
 (0)