[PATCH] rust: cred: update AlwaysRefCounted import to sync::aref

Shankari Anand posted 1 patch 1 month, 2 weeks ago
rust/kernel/cred.rs | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
[PATCH] rust: cred: update AlwaysRefCounted import to sync::aref
Posted by Shankari Anand 1 month, 2 weeks ago
Update the import of `AlwaysRefCounted` in `cred.rs` to use `sync::aref`
instead of `types`.

This is part of the ongoing effort to move `ARef` and
`AlwaysRefCounted` to the `sync` module for better modularity.

Suggested-by: Benno Lossin <lossin@kernel.org>
Link: https://github.com/Rust-for-Linux/linux/issues/1173
Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
---
It part of a subsystem-wise split series, as suggested in:
https://lore.kernel.org/rust-for-linux/CANiq72=NSRMV_6UxXVgkebmWmbgN4i=sfRszr-G+x3W5A4DYOg@mail.gmail.com/T/#u
This split series is intended to ease review and subsystem-level maintenance.

The original moving patch is here: (commit 07dad44aa9a93)
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=07dad44aa9a93b16af19e8609a10b241c352b440

Gradually the re-export from types.rs will be eliminated in the
future cycle.
---
 rust/kernel/cred.rs | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/rust/kernel/cred.rs b/rust/kernel/cred.rs
index 2599f01e8b28..4a2229542fb7 100644
--- a/rust/kernel/cred.rs
+++ b/rust/kernel/cred.rs
@@ -8,11 +8,7 @@
 //!
 //! Reference: <https://www.kernel.org/doc/html/latest/security/credentials.html>
 
-use crate::{
-    bindings,
-    task::Kuid,
-    types::{AlwaysRefCounted, Opaque},
-};
+use crate::{bindings, sync::aref::AlwaysRefCounted, task::Kuid, types::Opaque};
 
 /// Wraps the kernel's `struct cred`.
 ///

base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
-- 
2.34.1
Re: [PATCH] rust: cred: update AlwaysRefCounted import to sync::aref
Posted by Benno Lossin 1 month, 2 weeks ago
On Sat Aug 16, 2025 at 1:44 PM CEST, Shankari Anand wrote:
> Update the import of `AlwaysRefCounted` in `cred.rs` to use `sync::aref`
> instead of `types`.
>
> This is part of the ongoing effort to move `ARef` and
> `AlwaysRefCounted` to the `sync` module for better modularity.
>
> Suggested-by: Benno Lossin <lossin@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1173
> Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
> ---
> It part of a subsystem-wise split series, as suggested in:
> https://lore.kernel.org/rust-for-linux/CANiq72=NSRMV_6UxXVgkebmWmbgN4i=sfRszr-G+x3W5A4DYOg@mail.gmail.com/T/#u
> This split series is intended to ease review and subsystem-level maintenance.
>
> The original moving patch is here: (commit 07dad44aa9a93)
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=07dad44aa9a93b16af19e8609a10b241c352b440
>
> Gradually the re-export from types.rs will be eliminated in the
> future cycle.
> ---
>  rust/kernel/cred.rs | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)

Reviewed-by: Benno Lossin <lossin@kernel.org>

---
Cheers,
Benno
Re: [PATCH] rust: cred: update AlwaysRefCounted import to sync::aref
Posted by Serge E. Hallyn 1 month, 2 weeks ago
On Sat, Aug 16, 2025 at 05:14:09PM +0530, Shankari Anand wrote:
> Update the import of `AlwaysRefCounted` in `cred.rs` to use `sync::aref`
> instead of `types`.

Thank you for forwarding, Miguel.

As far as I can see from the included links, this looks good.

> This is part of the ongoing effort to move `ARef` and
> `AlwaysRefCounted` to the `sync` module for better modularity.
> 
> Suggested-by: Benno Lossin <lossin@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1173
> Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>

Acked-by: Serge Hallyn <serge@hallyn.com>

> ---
> It part of a subsystem-wise split series, as suggested in:
> https://lore.kernel.org/rust-for-linux/CANiq72=NSRMV_6UxXVgkebmWmbgN4i=sfRszr-G+x3W5A4DYOg@mail.gmail.com/T/#u
> This split series is intended to ease review and subsystem-level maintenance.
> 
> The original moving patch is here: (commit 07dad44aa9a93)
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=07dad44aa9a93b16af19e8609a10b241c352b440
> 
> Gradually the re-export from types.rs will be eliminated in the
> future cycle.
> ---
>  rust/kernel/cred.rs | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/rust/kernel/cred.rs b/rust/kernel/cred.rs
> index 2599f01e8b28..4a2229542fb7 100644
> --- a/rust/kernel/cred.rs
> +++ b/rust/kernel/cred.rs
> @@ -8,11 +8,7 @@
>  //!
>  //! Reference: <https://www.kernel.org/doc/html/latest/security/credentials.html>
>  
> -use crate::{
> -    bindings,
> -    task::Kuid,
> -    types::{AlwaysRefCounted, Opaque},
> -};
> +use crate::{bindings, sync::aref::AlwaysRefCounted, task::Kuid, types::Opaque};
>  
>  /// Wraps the kernel's `struct cred`.
>  ///
> 
> base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
> -- 
> 2.34.1
>
Re: [PATCH] rust: cred: update AlwaysRefCounted import to sync::aref
Posted by Paul Moore 1 month, 2 weeks ago
On Sun, Aug 17, 2025 at 11:26 PM Serge E. Hallyn <serge@hallyn.com> wrote:
> On Sat, Aug 16, 2025 at 05:14:09PM +0530, Shankari Anand wrote:
> > Update the import of `AlwaysRefCounted` in `cred.rs` to use `sync::aref`
> > instead of `types`.
>
> Thank you for forwarding, Miguel.
>
> As far as I can see from the included links, this looks good.
>
> > This is part of the ongoing effort to move `ARef` and
> > `AlwaysRefCounted` to the `sync` module for better modularity.
> >
> > Suggested-by: Benno Lossin <lossin@kernel.org>
> > Link: https://github.com/Rust-for-Linux/linux/issues/1173
> > Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
>
> Acked-by: Serge Hallyn <serge@hallyn.com>

As mentioned previously, I'm still not well versed in Rust so as long
as Serge is happy with it, I'm good with it too :)

I'm guessing it probably makes sense to include rust/kernel/cred.rs in
the creds MAINTAINERS section just as we did (or will do) with the LSM
Rust shim?

-- 
paul-moore.com
Re: [PATCH] rust: cred: update AlwaysRefCounted import to sync::aref
Posted by Alice Ryhl 1 month, 2 weeks ago
On Mon, Aug 18, 2025 at 11:22 PM Paul Moore <paul@paul-moore.com> wrote:
>
> On Sun, Aug 17, 2025 at 11:26 PM Serge E. Hallyn <serge@hallyn.com> wrote:
> > On Sat, Aug 16, 2025 at 05:14:09PM +0530, Shankari Anand wrote:
> > > Update the import of `AlwaysRefCounted` in `cred.rs` to use `sync::aref`
> > > instead of `types`.
> >
> > Thank you for forwarding, Miguel.
> >
> > As far as I can see from the included links, this looks good.
> >
> > > This is part of the ongoing effort to move `ARef` and
> > > `AlwaysRefCounted` to the `sync` module for better modularity.
> > >
> > > Suggested-by: Benno Lossin <lossin@kernel.org>
> > > Link: https://github.com/Rust-for-Linux/linux/issues/1173
> > > Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

> > Acked-by: Serge Hallyn <serge@hallyn.com>
>
> As mentioned previously, I'm still not well versed in Rust so as long
> as Serge is happy with it, I'm good with it too :)
>
> I'm guessing it probably makes sense to include rust/kernel/cred.rs in
> the creds MAINTAINERS section just as we did (or will do) with the LSM
> Rust shim?

That would make sense to me.

My understanding is that this patch, unlike the pin-init one, is
intended to go through the LSM / CRED tree rather than taking
everything through a shared tree with Acked-bys.

Alice
Re: [PATCH] rust: cred: update AlwaysRefCounted import to sync::aref
Posted by Paul Moore 1 month, 2 weeks ago
On Mon, Aug 18, 2025 at 6:06 PM Alice Ryhl <aliceryhl@google.com> wrote:
> On Mon, Aug 18, 2025 at 11:22 PM Paul Moore <paul@paul-moore.com> wrote:
> >
> > On Sun, Aug 17, 2025 at 11:26 PM Serge E. Hallyn <serge@hallyn.com> wrote:
> > > On Sat, Aug 16, 2025 at 05:14:09PM +0530, Shankari Anand wrote:
> > > > Update the import of `AlwaysRefCounted` in `cred.rs` to use `sync::aref`
> > > > instead of `types`.
> > >
> > > Thank you for forwarding, Miguel.
> > >
> > > As far as I can see from the included links, this looks good.
> > >
> > > > This is part of the ongoing effort to move `ARef` and
> > > > `AlwaysRefCounted` to the `sync` module for better modularity.
> > > >
> > > > Suggested-by: Benno Lossin <lossin@kernel.org>
> > > > Link: https://github.com/Rust-for-Linux/linux/issues/1173
> > > > Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
>
> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
>
> > > Acked-by: Serge Hallyn <serge@hallyn.com>
> >
> > As mentioned previously, I'm still not well versed in Rust so as long
> > as Serge is happy with it, I'm good with it too :)
> >
> > I'm guessing it probably makes sense to include rust/kernel/cred.rs in
> > the creds MAINTAINERS section just as we did (or will do) with the LSM
> > Rust shim?
>
> That would make sense to me.

Okay, patch sent.

https://lore.kernel.org/linux-security-module/20250819195841.238246-2-paul@paul-moore.com

> My understanding is that this patch, unlike the pin-init one, is
> intended to go through the LSM / CRED tree rather than taking
> everything through a shared tree with Acked-bys.

In that case, I've gone ahead and merged Shankari's patch into lsm/dev
and will plan to send it up to Linus during the next merge window.  If
something changes and the Rust folks want to send this up via a Rust
tree just let me know and I'll drop the patch.

-- 
paul-moore.com
Re: [PATCH] rust: cred: update AlwaysRefCounted import to sync::aref
Posted by Miguel Ojeda 1 month, 2 weeks ago
On Tue, Aug 19, 2025 at 10:06 PM Paul Moore <paul@paul-moore.com> wrote:
>
> Okay, patch sent.
>
> https://lore.kernel.org/linux-security-module/20250819195841.238246-2-paul@paul-moore.com
>
> In that case, I've gone ahead and merged Shankari's patch into lsm/dev
> and will plan to send it up to Linus during the next merge window.  If
> something changes and the Rust folks want to send this up via a Rust
> tree just let me know and I'll drop the patch.

Sounds good, thanks a lot -- I replied on the patch.

Cheers,
Miguel
Re: [PATCH] rust: cred: update AlwaysRefCounted import to sync::aref
Posted by Miguel Ojeda 1 month, 2 weeks ago
On Sat, Aug 16, 2025 at 1:44 PM Shankari Anand
<shankari.ak0208@gmail.com> wrote:
>
> Update the import of `AlwaysRefCounted` in `cred.rs` to use `sync::aref`
> instead of `types`.
>
> This is part of the ongoing effort to move `ARef` and
> `AlwaysRefCounted` to the `sync` module for better modularity.
>
> Suggested-by: Benno Lossin <lossin@kernel.org>
> Link: https://github.com/Rust-for-Linux/linux/issues/1173
> Signed-off-by: Shankari Anand <shankari.ak0208@gmail.com>
> ---
> It part of a subsystem-wise split series, as suggested in:
> https://lore.kernel.org/rust-for-linux/CANiq72=NSRMV_6UxXVgkebmWmbgN4i=sfRszr-G+x3W5A4DYOg@mail.gmail.com/T/#u
> This split series is intended to ease review and subsystem-level maintenance.
>
> The original moving patch is here: (commit 07dad44aa9a93)
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=07dad44aa9a93b16af19e8609a10b241c352b440
>
> Gradually the re-export from types.rs will be eliminated in the
> future cycle.

Cc'ing Paul, Serge and -security, just in case.

Thanks!

Cheers,
Miguel