linux/drivers/android/binder
Alice Ryhl dd7aea9ee2 rust_binder: do not query current thread for all ioctls
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>
Cc: stable <stable@kernel.org>
Fixes: eafedbc7c0 ("rust_binder: add Rust Binder driver")
Acked-by: Carlos Llamas <cmllamas@google.com>
Link: https://patch.msgid.link/20260727-binder-cur-thread-v1-1-8edf2b64e235@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-07-31 11:00:42 +02:00
..
node
range_alloc rust: allow clippy::collapsible_if globally 2026-04-30 23:21:31 +02:00
allocation.rs rust_binder: use a u64 stride when cleaning up the offsets array 2026-07-03 12:28:28 +02:00
context.rs rust_binder: shrink all_procs when deregistering processes 2026-02-26 21:37:53 -08:00
deferred_close.rs
defs.rs
error.rs rust_binder: fix BINDER_GET_EXTENDED_ERROR 2026-07-03 12:18:59 +02:00
freeze.rs rust_binder: clear freeze listener on node removal 2026-07-03 13:54:10 +02:00
Makefile rust: declare cfi_encoding for lru_status 2026-04-07 10:00:25 +02:00
node.rs rust_binder: clear freeze listener on node removal 2026-07-03 13:54:10 +02:00
page_range.rs rust_binder: use lock_vma_under_rcu() in shrinker 2026-05-23 13:47:32 +02:00
process.rs rust_binder: do not query current thread for all ioctls 2026-07-31 11:00:42 +02:00
rust_binder_events.c rust_binder: synchronize Rust Binder stats with freeze commands 2026-07-03 12:27:38 +02:00
rust_binder_events.h rust_binder: add command/return tracepoints 2026-04-01 12:18:22 +02:00
rust_binder_internal.h
rust_binder_main.rs Char/Misc/IIO/and others driver updates for 7.1-rc1 2026-04-24 13:23:50 -07:00
rust_binder.h rust_binder: add fd translation tracepoints 2026-04-01 12:18:22 +02:00
rust_binderfs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
stats.rs rust_binder: synchronize Rust Binder stats with freeze commands 2026-07-03 12:27:38 +02:00
thread.rs rust_binder: only print failure if error has source 2026-07-17 15:30:09 +02:00
trace.rs rust_binder: add command/return tracepoints 2026-04-01 12:18:22 +02:00
transaction.rs rust_binder: fix BINDER_GET_EXTENDED_ERROR 2026-07-03 12:18:59 +02:00