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: <DB2GJB0ZRCSN.32R6OOCOMSO2Q@kernel.org>
Date: Thu, 03 Jul 2025 15:34:23 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Danilo Krummrich" <dakr@...nel.org>, "Greg Kroah-Hartman"
 <gregkh@...uxfoundation.org>
Cc: "Alice Ryhl" <aliceryhl@...gle.com>, "Matthew Maurer"
 <mmaurer@...gle.com>, "Miguel Ojeda" <ojeda@...nel.org>, "Alex Gaynor"
 <alex.gaynor@...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@...nel.org>,
 "Trevor Gross" <tmgross@...ch.edu>, "Rafael J. Wysocki"
 <rafael@...nel.org>, "Sami Tolvanen" <samitolvanen@...gle.com>, "Timur
 Tabi" <ttabi@...dia.com>, <linux-kernel@...r.kernel.org>,
 <rust-for-linux@...r.kernel.org>, "Dirk Behme" <dirk.behme@...bosch.com>
Subject: Re: [PATCH v8 4/6] rust: debugfs: Support arbitrary owned backing
 for File

On Thu Jul 3, 2025 at 2:29 PM CEST, Danilo Krummrich wrote:
> So, what I'm trying to say is, I think it's a good thing if fields that are
> protected by the same lock can't be exposed through separate files, because it
> means that the fields only make sense in the context of each other.

I think that even the pin-init API can have multiple files for different
elements of the locked structure, you just need to nest `File`:

    #[pin_data]
    struct Process {
        task: ARef<Task>,
        #[pin]
        inner: File<File<SpinLock<ProcessInner>>>,
    }
    
    pub(crate) struct ProcessInner {
        threads: RBTree<i32, Arc<Thread>>,
        max_threads: u32,
    }

Now you can do:

    pin_init!(Process {
        inner <- dir.create_file(
            "threads",
            dir.create_file("max_threads", new_spinlock!(...)),
        ),
        // ...
    })

But I'd say this will at least raise eyebrows for the reviewers, which
is good, since it catches the footgun.

---
Cheers,
Benno

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ