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] [thread-next>] [day] [month] [year] [list]
Message-ID: <882a4ba5-b0ef-4c21-8167-e2949424912c@redhat.com>
Date: Mon, 10 Jun 2024 23:46:55 +0300
From: Abdiel Janulgue <abdiel@...hat.com>
To: Alice Ryhl <aliceryhl@...gle.com>, Miguel Ojeda <ojeda@...nel.org>,
 Matthew Wilcox <willy@...radead.org>, Al Viro <viro@...iv.linux.org.uk>,
 Andrew Morton <akpm@...ux-foundation.org>, Kees Cook <keescook@...omium.org>
Cc: Alex Gaynor <alex.gaynor@...il.com>,
 Wedson Almeida Filho <wedsonaf@...il.com>, Boqun Feng
 <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
 Björn Roy Baron <bjorn3_gh@...tonmail.com>,
 Benno Lossin <benno.lossin@...ton.me>,
 Andreas Hindborg <a.hindborg@...sung.com>,
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 Arve Hjønnevåg <arve@...roid.com>,
 Todd Kjos <tkjos@...roid.com>, Martijn Coenen <maco@...roid.com>,
 Joel Fernandes <joel@...lfernandes.org>, Carlos Llamas
 <cmllamas@...gle.com>, Suren Baghdasaryan <surenb@...gle.com>,
 Arnd Bergmann <arnd@...db.de>, Trevor Gross <tmgross@...ch.edu>,
 linux-mm@...ck.org, linux-kernel@...r.kernel.org,
 rust-for-linux@...r.kernel.org, Christian Brauner <brauner@...nel.org>,
 Danilo Krummrich <dakr@...hat.com>
Subject: Re: [PATCH v7 4/4] rust: add abstraction for `struct page`

Hi,

On 28/05/2024 17:58, Alice Ryhl wrote:
> Adds a new struct called `Page` that wraps a pointer to `struct page`.
> This struct is assumed to hold ownership over the page, so that Rust
> code can allocate and manage pages directly.
> 
> +
> +impl Drop for Page {
> +    fn drop(&mut self) {
> +        // SAFETY: By the type invariants, we have ownership of the page and can free it.
> +        unsafe { bindings::__free_pages(self.page.as_ptr(), 0) };
> +    }
> +}
> 

What about cases where the struct page pointer is not owned or allocated 
by this wrapper? For example, pages returned vmalloc_to_page()?
Any thoughts about exposing a provision to avoid freeing those pages 
during Drop?

We've been experimenting in adapting this Page wrapper in advance for 
page management within the Nova DRM driver.

/Abdiel


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ