The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Keshav Verma" <iganschel@gmail.com>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Arve Hjønnevåg" <arve@android.com>,
	"Todd Kjos" <tkjos@android.com>,
	"Christian Brauner" <brauner@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org
Subject: Re: [PATCH] rust_binder: check context manager before creating node
Date: Thu, 18 Jun 2026 11:52:14 +0000	[thread overview]
Message-ID: <ajPb7jLf5dkU_Amk@google.com> (raw)
In-Reply-To: <2026061856-rare-envoy-d585@gregkh>

On Thu, Jun 18, 2026 at 12:27:49PM +0200, Greg Kroah-Hartman wrote:
> On Thu, Jun 18, 2026 at 03:50:30AM +0530, Keshav Verma wrote:
> > Rust Binder currently creates the Binder node before checking
> > whether a context manager is already registered. If a context manager already
> > exists, set_manager_node() returns -EBUSY after node state has already been
> > created.
> 
> Odd line-wrapping :(
> 
> > 
> > Add a check before creating the node to match the C Binder ordering for
> > the common already registered case. Keep the final checks in set_manager_node()
> > so races with another caller are still handled after node creation.
> > 
> > Signed-off-by: Keshav Verma <iganschel@gmail.com>
> 
> What commit id does this "fix"?

There's no need to mark this as a fix. It's nothing more than a
fast-path that does less work when exiting on error. As the commit
message notes, the existing error check after get_node() is still needed
because otherwise two threads could invoke this in parallel leading to
multiple context managers.

> > +    pub(crate) fn check_manager(&self, cred: &Credential) -> Result {
> > +        let manager = self.manager.lock();
> > +        if manager.node.is_some() {
> > +            pr_warn!("BINDER_SET_CONTEXT_MGR already set");
> 
> How can this be triggered?

If two processes try to register themselves as the context manager of
this context, this occurs. The warning should probably be using
rate-limited printing.

Alice

  parent reply	other threads:[~2026-06-18 11:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17 22:20 [PATCH] rust_binder: check context manager before creating node Keshav Verma
2026-06-18 10:27 ` Greg Kroah-Hartman
     [not found]   ` <CAPE_3zLCOwqa8Yb21oAb8i9AHW-UPqW=+9848fUtuTKK6wAZDA@mail.gmail.com>
2026-06-18 11:28     ` Greg Kroah-Hartman
2026-06-18 11:33     ` Miguel Ojeda
2026-06-18 11:52   ` Alice Ryhl [this message]
2026-06-18 12:12 ` [PATCH v2] " Keshav Verma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ajPb7jLf5dkU_Amk@google.com \
    --to=aliceryhl@google.com \
    --cc=arve@android.com \
    --cc=boqun@kernel.org \
    --cc=brauner@kernel.org \
    --cc=cmllamas@google.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=iganschel@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tkjos@android.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox