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: <79ce2394-25af-469f-88f1-5de31b9f48f6@proton.me>
Date: Thu, 01 Aug 2024 15:29:15 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>, 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>, Matthew Wilcox <willy@...radead.org>, "Liam R. Howlett" <Liam.Howlett@...cle.com>, Vlastimil Babka <vbabka@...e.cz>, Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, linux-kernel@...r.kernel.org, linux-mm@...ck.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v3] rust: mm: add abstractions for mm_struct and vm_area_struct

On 01.08.24 16:37, Alice Ryhl wrote:
> On Thu, Aug 1, 2024 at 4:02 PM Benno Lossin <benno.lossin@...ton.me> wrote:
>> On 01.08.24 14:58, Alice Ryhl wrote:
>>> +/// A wrapper for the kernel's `struct mm_struct`.
>>> +///
>>> +/// This type is identical to `MmWithUser` except that it uses `mmput_async` when dropping a
>>> +/// refcount. This means that the destructor of `ARef<MmWithUserAsync>` is safe to call in atomic
>>> +/// context.
>>
>> Missing Invariants.
> 
> Hmm. Structs will inherit invariants from their fields, no?

No, usually the fields handle their invariants on their own, eg NonNull
can only be constructed if the pointer is not null. But Refcounted
structs are somewhat special in this regard, since you cannot construct
them by-value. Thus if you build a new struct that contains them, then
that also needs to be refcounted and have its own invariant to guarantee
that the field still is refcounted.

---
Cheers,
Benno


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ