From 5ac876e17df37315585f178ec3b762786e05a092 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sun, 30 May 2021 10:47:05 -0600 Subject: Adapt aio to the world of async/await, and fix some potential unsoundness. * libc::aiocb must not be moved while the kernel has a pointer to it. This change enforces that requirement by using std::pin. * Split LioCbBuilder out of LioCb. struct LioCb relied on the (incorrect) assumption that a Vec's elements have a stable location in memory. That's not true; they can be moved during Vec::push. The solution is to use a Vec in the new Builder struct, but finalize it to a boxed slice (which doesn't support push) before allowing it to be submitted to the kernel. * Eliminate owned buffer types. mio-aio no longer uses owned buffers with nix::aio. There's little need for it in the world of async/await. I'm not aware of any other consumers. This substantially simplifies the code. --- CHANGELOG.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'CHANGELOG.md') diff --git a/CHANGELOG.md b/CHANGELOG.md index 1e163be9..0fc57f62 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,18 @@ This project adheres to [Semantic Versioning](https://semver.org/). (#[1429](https://github.com/nix-rust/nix/pull/1429)) - Made `Uid::is_root` a `const fn` (#[1429](https://github.com/nix-rust/nix/pull/1429)) +- `AioCb` is now always pinned. Once a `libc::aiocb` gets sent to the kernel, + its address in memory must not change. Nix now enforces that by using + `std::pin`. Most users won't need to change anything, except when using + `aio_suspend`. See that method's documentation for the new usage. + (#[1440](https://github.com/nix-rust/nix/pull/1440)) +- `LioCb` is now constructed using a distinct `LioCbBuilder` struct. This + avoids a soundness issue with the old `LioCb`. Usage is similar but + construction now uses the builder pattern. See the documentation for + details. + (#[1440](https://github.com/nix-rust/nix/pull/1440)) +- Minimum supported Rust version is now 1.41.0. + ([#1440](https://github.com/nix-rust/nix/pull/1440)) ### Fixed - Allow `sockaddr_ll` size, as reported by the Linux kernel, to be smaller then it's definition @@ -28,6 +40,11 @@ This project adheres to [Semantic Versioning](https://semver.org/). - Removed `sys::socket::accept4` from Android arm because libc removed it in version 0.2.87. ([#1399](https://github.com/nix-rust/nix/pull/1399)) +- `AioCb::from_boxed_slice` and `AioCb::from_boxed_mut_slice` have been + removed. They were useful with earlier versions of Rust, but should no + longer be needed now that async/await are available. `AioCb`s now work + exclusively with borrowed buffers, not owned ones. + (#[1440](https://github.com/nix-rust/nix/pull/1440)) ## [0.20.0] - 20 February 2021 ### Added -- cgit v1.2.3