From e3d6df57801efaa4b01887d2fa67c388065d6bb9 Mon Sep 17 00:00:00 2001 From: Amos Wenger Date: Thu, 6 Oct 2022 20:36:14 +0200 Subject: [PATCH] Box the socket address to allow moving the future (which async functions routinely do) --- src/driver/connect.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/driver/connect.rs b/src/driver/connect.rs index d4dad8ee..c3168fc1 100644 --- a/src/driver/connect.rs +++ b/src/driver/connect.rs @@ -6,7 +6,9 @@ use std::io; /// Open a file pub(crate) struct Connect { fd: SharedFd, - socket_addr: SockAddr, + // this avoids a UAF (UAM?) if the future is moved, but not if the future is + // dropped. no Op can be dropped before completion in tokio-uring land right now. + socket_addr: Box, } impl Op { @@ -17,7 +19,7 @@ impl Op { Op::submit_with( Connect { fd: fd.clone(), - socket_addr, + socket_addr: Box::new(socket_addr), }, |connect| { opcode::Connect::new(