[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240807160457.73445f04@eugeo>
Date: Wed, 7 Aug 2024 16:04:57 +0100
From: Gary Guo <gary@...yguo.net>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>, Boqun Feng
<boqun.feng@...il.com>, "Björn Roy Baron"
<bjorn3_gh@...tonmail.com>, Benno Lossin <benno.lossin@...ton.me>, Andreas
Hindborg <a.hindborg@...sung.com>, Peter Zijlstra <peterz@...radead.org>,
Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner
<brauner@...nel.org>, 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>, Dan Williams <dan.j.williams@...el.com>,
Matthew Wilcox <willy@...radead.org>, Thomas Gleixner <tglx@...utronix.de>,
Daniel Xu <dxu@...uu.xyz>, Martin Rodriguez Reboredo <yakoyoku@...il.com>,
Trevor Gross <tmgross@...ch.edu>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, linux-fsdevel@...r.kernel.org, Kees Cook
<kees@...nel.org>
Subject: Re: [PATCH v8 6/8] rust: file: add `FileDescriptorReservation`
On Thu, 25 Jul 2024 14:27:39 +0000
Alice Ryhl <aliceryhl@...gle.com> wrote:
> From: Wedson Almeida Filho <wedsonaf@...il.com>
>
> Allow for the creation of a file descriptor in two steps: first, we
> reserve a slot for it, then we commit or drop the reservation. The first
> step may fail (e.g., the current process ran out of available slots),
> but commit and drop never fail (and are mutually exclusive).
>
> This is needed by Rust Binder when fds are sent from one process to
> another. It has to be a two-step process to properly handle the case
> where multiple fds are sent: The operation must fail or succeed
> atomically, which we achieve by first reserving the fds we need, and
> only installing the files once we have reserved enough fds to send the
> files.
>
> Fd reservations assume that the value of `current` does not change
> between the call to get_unused_fd_flags and the call to fd_install (or
> put_unused_fd). By not implementing the Send trait, this abstraction
> ensures that the `FileDescriptorReservation` cannot be moved into a
> different process.
>
> Signed-off-by: Wedson Almeida Filho <wedsonaf@...il.com>
> Co-developed-by: Alice Ryhl <aliceryhl@...gle.com>
> Reviewed-by: Benno Lossin <benno.lossin@...ton.me>
> Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@...il.com>
> Reviewed-by: Trevor Gross <tmgross@...ch.edu>
> Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
Reviewed-by: Gary Guo <gary@...yguo.net>
> ---
> rust/kernel/fs/file.rs | 75 +++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 74 insertions(+), 1 deletion(-)
Powered by blists - more mailing lists