[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAH5fLgjSr9bbGc02gDdfFAUTyGiR__6K8qZYQNZLRe_E=Cypjw@mail.gmail.com>
Date: Thu, 8 Feb 2024 16:07:53 +0100
From: Alice Ryhl <aliceryhl@...gle.com>
To: Martin Rodriguez Reboredo <yakoyoku@...il.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>, 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>,
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>,
Kees Cook <keescook@...omium.org>, Matthew Wilcox <willy@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>, Daniel Xu <dxu@...uu.xyz>, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v4 4/9] rust: cred: add Rust abstraction for `struct cred`
On Thu, Feb 8, 2024 at 1:35 AM Martin Rodriguez Reboredo
<yakoyoku@...il.com> wrote:
>
> On 2/2/24 07:55, Alice Ryhl wrote:
> > From: Wedson Almeida Filho <wedsonaf@...il.com>
> >
> > Add a wrapper around `struct cred` called `Credential`, and provide
> > functionality to get the `Credential` associated with a `File`.
> >
> > Rust Binder must check the credentials of processes when they attempt to
> > perform various operations, and these checks usually take a
> > `&Credential` as parameter. The security_binder_set_context_mgr function
> > would be one example. This patch is necessary to access these security_*
> > methods from Rust.
> >
> > Signed-off-by: Wedson Almeida Filho <wedsonaf@...il.com>
> > Co-developed-by: Alice Ryhl <aliceryhl@...gle.com>
> > Signed-off-by: Alice Ryhl <aliceryhl@...gle.com>
> > ---
> > [...]
> > + /// Returns the credentials of the task that originally opened the file.
> > + pub fn cred(&self) -> &Credential {
> > + // SAFETY: It's okay to read the `f_cred` field without synchronization because `f_cred` is
> > + // never changed after initialization of the file.
> > + let ptr = unsafe { (*self.as_ptr()).f_cred };
>
> From what I can see `file.f_cred` is valid from the moment `file` was
> initialized, worth to notice too IMO.
That's what it says?
Alice
Powered by blists - more mailing lists