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: <99a469db-da0a-47fe-a69e-38aafebb6d24@proton.me>
Date: Tue, 06 Aug 2024 14:30:22 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Alice Ryhl <aliceryhl@...gle.com>, Miguel Ojeda <ojeda@...nel.org>, Andrew Morton <akpm@...ux-foundation.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>, Andreas Hindborg <a.hindborg@...sung.com>, Marco Elver <elver@...gle.com>, Coly Li <colyli@...e.de>, Paolo Abeni <pabeni@...hat.com>, Pierre Gondois <pierre.gondois@....com>, Ingo Molnar <mingo@...nel.org>, Jakub Kicinski <kuba@...nel.org>, Wei Yang <richard.weiyang@...il.com>, Matthew Wilcox <willy@...radead.org>, linux-kernel@...r.kernel.org, rust-for-linux@...r.kernel.org, Kees Cook <kees@...nel.org>
Subject: Re: [PATCH v4 03/10] rust: list: add tracking for ListArc

On 06.08.24 15:58, Alice Ryhl wrote:
> Add the ability to track whether a ListArc exists for a given value,
> allowing for the creation of ListArcs without going through UniqueArc.
> 
> The `impl_list_arc_safe!` macro is extended with a `tracked_by` strategy
> that defers the tracking of ListArcs to a field of the struct.
> Additionally, the AtomicListArcTracker type is introduced, which can
> track whether a ListArc exists using an atomic. By deferring the
> tracking to a field of type AtomicListArcTracker, structs gain the
> ability to create ListArcs without going through a UniqueArc.
> 
> Rust Binder uses this for some objects where we want to be able to
> insert them into a linked list at any time. Using the
> AtomicListArcTracker, we are able to check whether an item is already in
> the list, and if not, we can create a `ListArc` and push it.
> 
> The macro has the ability to defer the tracking of ListArcs to a field,
> using whatever strategy that field has. Since we don't add any
> strategies other than AtomicListArcTracker, another similar option would
> be to hard-code that the field should be an AtomicListArcTracker.
> However, Rust Binder has a case where the AtomicListArcTracker is not
> stored directly in the struct, but in a sub-struct. Furthermore, the
> outer struct is generic:
> 
> struct Wrapper<T: ?Sized> {
>     links: ListLinks,
>     inner: T,
> }
> 
> Here, the Wrapper struct implements ListArcSafe with `tracked_by inner`,
> and then the various types used with `inner` also uses the macro to
> implement ListArcSafe. Some of them use the untracked strategy, and some
> of them use tracked_by with an AtomicListArcTracker. This way, Wrapper
> just inherits whichever choice `inner` has made.
> 
> Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
> ---
>  rust/kernel/list.rs     |   2 +-
>  rust/kernel/list/arc.rs | 171 +++++++++++++++++++++++++++++++++++++++++++++++-
>  2 files changed, 170 insertions(+), 3 deletions(-)

Reviewed-by: Benno Lossin <benno.lossin@...ton.me>

---
Cheers,
Benno


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ