Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,14 @@ advice applies to the end of the file. To convert an arbitrary `u64` value to

[`rustix::fs::fadvise`]: https://docs.rs/rustix/1.0.0/rustix/fs/fn.fadvise.html

The [`sigmask`] and [`ts`] fields of [`rustix::io_uring::getevents_arg`]
changed from `u64` to [`rustix::io_uring::io_uring_ptr`], to better preserve
pointer provenance.

[`sigmask`]: https://docs.rs/rustix/1.0.0/rustix/io_uring/struct.io_uring_getevents_arg.html#structfield.sigmask
[`ts`]: https://docs.rs/rustix/1.0.0/rustix/io_uring/struct.io_uring_getevents_arg.html#structfield.ts
[`rustix::io_uring::getevents_arg`]: https://docs.rs/rustix/1.0.0/rustix/io_uring/struct.io_uring_getevents_arg.html
[`rustix::io_uring::io_uring_ptr`]: https://docs.rs/rustix/1.0.0-prerelease.0/rustix/io_uring/struct.io_uring_ptr.html

All explicitly deprecated functions and types have been removed. Their
deprecation messages will have identified alternatives.
21 changes: 19 additions & 2 deletions src/io_uring/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@ pub const IORING_NOTIF_USAGE_ZC_COPIED: i32 = sys::IORING_NOTIF_USAGE_ZC_COPIED
/// preserve strict-provenance, use a `*mut c_void`. On platforms where
/// pointers are narrower than 64 bits, this requires additional padding.
#[repr(C)]
#[cfg_attr(target_arch = "arm", repr(align(8)))]
#[derive(Copy, Clone)]
#[non_exhaustive]
pub struct io_uring_ptr {
Expand Down Expand Up @@ -1395,10 +1396,10 @@ pub struct io_uring_rsrc_update2 {
#[repr(C)]
#[derive(Debug, Copy, Clone, Default)]
pub struct io_uring_getevents_arg {
pub sigmask: u64,
pub sigmask: io_uring_ptr,
pub sigmask_sz: u32,
pub min_wait_usec: u32,
pub ts: u64,
pub ts: io_uring_ptr,
}

#[allow(missing_docs)]
Expand Down Expand Up @@ -1559,7 +1560,23 @@ mod tests {
fn io_uring_layouts() {
use sys as c;

// `io_uring_ptr` is a replacement for `u64`.
assert_eq_size!(io_uring_ptr, u64);
assert_eq_align!(io_uring_ptr, u64);

// Test that pointers are stored in io_uring_ptr` in the way that
// io_uring stores them in a `u64`.
unsafe {
const MAGIC: u64 = !0x0123456789abcdef;
let ptr = io_uring_ptr::from(MAGIC as usize as *mut c_void);
assert_eq!(ptr.ptr, MAGIC as usize as *mut c_void);
#[cfg(target_pointer_width = "16")]
assert_eq!(ptr.__pad16, 0);
#[cfg(any(target_pointer_width = "16", target_pointer_width = "32"))]
assert_eq!(ptr.__pad32, 0);
let int = core::mem::transmute::<io_uring_ptr, u64>(ptr);
assert_eq!(int, MAGIC as usize as u64);
}

check_renamed_type!(off_or_addr2_union, io_uring_sqe__bindgen_ty_1);
check_renamed_type!(addr_or_splice_off_in_union, io_uring_sqe__bindgen_ty_2);
Expand Down