From: Carlos Llamas <cmllamas@google.com>
To: Alice Ryhl <aliceryhl@google.com>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>, "Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Daniel Almeida" <daniel.almeida@collabora.com>,
"Tamir Duberstein" <tamird@kernel.org>,
"Alexandre Courbot" <acourbot@nvidia.com>,
"Onur Özkan" <work@onurozkan.dev>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust_binder: do not query current thread for all ioctls
Date: Mon, 27 Jul 2026 19:24:43 +0000 [thread overview]
Message-ID: <amewewIwdet8iSat@google.com> (raw)
In-Reply-To: <20260727-binder-cur-thread-v1-1-8edf2b64e235@google.com>
On Mon, Jul 27, 2026 at 12:28:59PM +0000, Alice Ryhl wrote:
> The get_current_thread() method is currently called for every ioctl to
> ensure that a Thread struct exists for the thread calling into the
> driver. However, not all ioctls require a Thread object, so this means
> we are unnecessarily creating these objects in cases where we don't need
> to. If said thread does not invoke BINDER_THREAD_EXIT on exit, Binder's
> Thread struct stays around until the fd is closed. For long-lived
> processes the Thread object is effectively leaked.
>
> Furthermore, when the BINDER_GET_NODE_DEBUG_INFO ioctl is invoked by
> libmemunreachable to ensure that objects reachable only through the
> Binder driver are not considered leaked, this is done from a fork of the
> process owning the fd, which means that it fails the group_leader check
> inside get_current_thread(). This results in EINVAL errors for this
> ioctl, causing libmemunreachable to report a false positive memory leak.
>
> Thus, do not invoke get_current_thread() for ioctls that do not require
> it.
>
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
> ---
LGTM,
Acked-by: Carlos Llamas <cmllamas@google.com>
prev parent reply other threads:[~2026-07-27 19:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 12:28 Alice Ryhl
2026-07-27 12:48 ` Alice Ryhl
2026-07-27 19:24 ` Carlos Llamas [this message]
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=amewewIwdet8iSat@google.com \
--to=cmllamas@google.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/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
all inboxes | Powered by JetHome®