Skip to content

Commit 8e4abe8

Browse files
kalyazinroypat
authored andcommitted
fix(vmm): write_all in process_vcpu_userfault
This is to make sure that we always write the entire FaultRequest message even if the syscall was interrupted. Signed-off-by: Nikita Kalyazin <[email protected]>
1 parent 6a3a1d8 commit 8e4abe8

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/vmm/src/lib.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -654,21 +654,11 @@ impl Vmm {
654654
let fault_request_json =
655655
serde_json::to_string(&fault_request).expect("Failed to serialize fault request");
656656

657-
let written = self
658-
.uffd_socket
657+
self.uffd_socket
659658
.as_ref()
660659
.expect("Uffd socket is not set")
661-
.write(fault_request_json.as_bytes())
660+
.write_all(fault_request_json.as_bytes())
662661
.expect("Failed to write to uffd socket");
663-
664-
if written != fault_request_json.len() {
665-
panic!(
666-
"Failed to write the entire fault request to the uffd socket: expected {}, \
667-
written {}",
668-
fault_request_json.len(),
669-
written
670-
);
671-
}
672662
}
673663

674664
fn active_event_in_uffd_socket(&self, source: RawFd, event_set: EventSet) -> bool {

0 commit comments

Comments
 (0)