lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DC19IMWVL93E.S1AO2KPXB3HU@kernel.org>
Date: Wed, 13 Aug 2025 13:27:41 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Alice Ryhl" <aliceryhl@...gle.com>
Cc: "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>, "Alexander Viro"
 <viro@...iv.linux.org.uk>, "Arnd Bergmann" <arnd@...db.de>, "Miguel Ojeda"
 <ojeda@...nel.org>, "Boqun Feng" <boqun.feng@...il.com>, "Gary Guo"
 <gary@...yguo.net>, Björn Roy Baron
 <bjorn3_gh@...tonmail.com>, "Andreas Hindborg" <a.hindborg@...nel.org>,
 "Trevor Gross" <tmgross@...ch.edu>, "Matthew Maurer" <mmaurer@...gle.com>,
 "Lee Jones" <lee@...nel.org>, <linux-kernel@...r.kernel.org>,
 <rust-for-linux@...r.kernel.org>, "Benno Lossin" <lossin@...nel.org>
Subject: Re: [PATCH v4 1/4] rust: iov: add iov_iter abstractions for
 ITER_SOURCE

On Wed Aug 13, 2025 at 10:27 AM CEST, Alice Ryhl wrote:
> +    /// Read data from this IO vector and append it to a vector.
> +    ///
> +    /// Returns the number of bytes that have been copied.
> +    #[inline]
> +    pub fn copy_from_iter_vec<A: Allocator>(
> +        &mut self,
> +        out: &mut Vec<u8, A>,
> +        flags: Flags,
> +    ) -> Result<usize> {
> +        out.reserve(self.len(), flags)?;
> +        let len = self.copy_from_iter_raw(out.spare_capacity_mut()).len();
> +        // SAFETY: `Self::copy_from_iter_raw` guarantees that the first `len` bytes of the spare
> +        // capacity have been initialized.

Technically, this covers the safety requirements from inc_len(). However, do we
want to provide a list of justifications if the unsafe functions has a list of
requirements, such that they are easier to match?

> +        unsafe { out.inc_len(len) };
> +        Ok(len)
> +    }

Either way,

Reviewed-by: Danilo Krummrich <dakr@...nel.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ