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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zv_Zs1fJso1-Fl2R@pollux>
Date: Fri, 4 Oct 2024 14:04:03 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: ojeda@...nel.org, alex.gaynor@...il.com, wedsonaf@...il.com,
	boqun.feng@...il.com, gary@...yguo.net, bjorn3_gh@...tonmail.com,
	benno.lossin@...ton.me, a.hindborg@...sung.com,
	aliceryhl@...gle.com, akpm@...ux-foundation.org,
	daniel.almeida@...labora.com, faith.ekstrand@...labora.com,
	boris.brezillon@...labora.com, lina@...hilina.net,
	mcanal@...lia.com, zhiw@...dia.com, cjia@...dia.com,
	jhubbard@...dia.com, airlied@...hat.com, ajanulgu@...hat.com,
	lyude@...hat.com, linux-kernel@...r.kernel.org,
	rust-for-linux@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v8 11/29] rust: alloc: implement kernel `Box`

On Fri, Oct 04, 2024 at 01:00:51AM +0200, Miguel Ojeda wrote:
> On Tue, Oct 1, 2024 at 5:01 PM Danilo Krummrich <dakr@...nel.org> wrote:
> >
> > +    /// # Examples
> > +    ///
> > +    /// ```
> > +    /// let x = KBox::new(24, GFP_KERNEL)?;
> > +    /// let ptr = KBox::into_raw(x);
> > +    /// let x = unsafe { KBox::from_raw(ptr) };
> 
> This is the only place that, after applying your series on top of the
> lints one (i.e. current `rust-next`), triggered a missing `// SAFETY`
> comment lint :)
> 
> If there is no new version, what do you want me to write when I apply it?

diff --git a/rust/kernel/alloc/kbox.rs b/rust/kernel/alloc/kbox.rs
index 5d20f6112cc2..ef1add933f60 100644
--- a/rust/kernel/alloc/kbox.rs
+++ b/rust/kernel/alloc/kbox.rs
@@ -147,6 +147,7 @@ impl<T, A> Box<T, A>
     /// ```
     /// let x = KBox::new(24, GFP_KERNEL)?;
     /// let ptr = KBox::into_raw(x);
+    /// // SAFETY: `ptr` comes from a previous call to `KBox::into_raw`.
     /// let x = unsafe { KBox::from_raw(ptr) };
     ///
     /// assert_eq!(*x, 24);

But maybe it's better to just send a new version, to also fix the missing
`#![feature(inline_const)]` for `Vec` and missing import for `size_of` in
`ArrayLayout`.

> 
> Thanks!
> 
> Cheers,
> Miguel
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ