From 1a089de6c97662bea3d9b572e3cf9a5f70ee3499 Mon Sep 17 00:00:00 2001 From: ollie <72926894+ollie-etl@users.noreply.github.com> Date: Thu, 2 Mar 2023 05:12:42 +0000 Subject: [PATCH] Bug: iovec array not stable during sendmsg_zc op (#257) The iovec array must be stable until either: - Operation completion, or - not doing IORING_SETUP_SQPOLL, and feature IORING_FEAT_SUBMIT_STABLE is present This fix takes the simple option of holding the iovec until operation is completed. --- src/io/sendmsg_zc.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/io/sendmsg_zc.rs b/src/io/sendmsg_zc.rs index efad3a0b..4a52429d 100644 --- a/src/io/sendmsg_zc.rs +++ b/src/io/sendmsg_zc.rs @@ -13,6 +13,8 @@ pub(crate) struct SendMsgZc { #[allow(dead_code)] io_bufs: Vec, #[allow(dead_code)] + io_slices: Vec>, + #[allow(dead_code)] socket_addr: Option>, msg_control: Option, msghdr: libc::msghdr, @@ -32,7 +34,7 @@ impl Op, MultiCQEFuture> { let mut msghdr: libc::msghdr = unsafe { std::mem::zeroed() }; - let mut io_slices: Vec = Vec::with_capacity(io_bufs.len()); + let mut io_slices: Vec> = Vec::with_capacity(io_bufs.len()); for io_buf in &io_bufs { io_slices.push(IoSlice::new(unsafe { @@ -74,6 +76,7 @@ impl Op, MultiCQEFuture> { fd: fd.clone(), io_bufs, socket_addr, + io_slices, msg_control, msghdr, bytes: 0,