From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jahnavi MN Date: Thu, 16 Jul 2026 08:37:48 +0000 Subject: [PATCH v4 6/7] rust_binder: Implement BINDER_DEBUG_DEATH_NOTIFICATION MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260716-rust_binder_debug_mask-v4-6-3d7436c2d2f2@google.com> References: <20260716-rust_binder_debug_mask-v4-0-3d7436c2d2f2@google.com> In-Reply-To: <20260716-rust_binder_debug_mask-v4-0-3d7436c2d2f2@google.com> To: Greg Kroah-Hartman , =?utf-8?q?Arve_Hj=C3=B8nnev=C3=A5g?= , Todd Kjos , Christian Brauner , Carlos Llamas , Alice Ryhl , Miguel Ojeda , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Daniel Almeida , Tamir Duberstein , Alexandre Courbot , =?utf-8?q?Onur_=C3=96zkan?= Cc: linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Jahnavi MN X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1784191078; l=2692; i=jahnavimn@google.com; s=20260702; h=from:subject:message-id; bh=JbTuHL6w3vDZL9VcRbA4qukZLLJuEs0Io07aTcZSl3U=; b=0SD0pPCuRQaNLetd1aYsu2934fsLU8mPM1QD1uuqVY6lPn/IXkmXrtoMFC5eoh4urjdqgZKwG kKUbIR2kStsA2LBvGUcWdHBXXFvTSrp7f+oDMeFHFKX9PQ199R4aEcf X-Developer-Key: i=jahnavimn@google.com; a=ed25519; pk=9aLfw3FepTOJwTS7jRXm7pDH87eBeZMXBPrqwU0//RE= X-Endpoint-Received: by B4 Relay for jahnavimn@google.com/20260702 with auth_id=849 List-Id: B4 Relay Submissions This adds dynamic debug logs for: - Memory allocation (OOM) failures when requesting death notifications - Registration and cancellation lifecycle events (BC_REQUEST / BC_CLEAR) - Delivery of death notification events to userspace (BR_DEAD_BINDER) Reviewed-by: Carlos Llamas Reviewed-by: Alice Ryhl Signed-off-by: Jahnavi MN --- drivers/android/binder/node.rs | 5 +++++ drivers/android/binder/process.rs | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/drivers/android/binder/node.rs b/drivers/android/binder/node.rs index fefa723d13c4..8a87dc366aa9 100644 --- a/drivers/android/binder/node.rs +++ b/drivers/android/binder/node.rs @@ -1107,6 +1107,11 @@ fn do_work( // We're still holding the inner lock, so it cannot be aborted while we insert it into // the delivered list. process_inner.death_delivered(self.clone()); + binder_debug!( + DeathNotification, + "sending death notification, cookie {:016x}", + cookie + ); BR_DEAD_BINDER }; diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs index 1d3a71292de0..eb2f08bec655 100644 --- a/drivers/android/binder/process.rs +++ b/drivers/android/binder/process.rs @@ -1253,6 +1253,10 @@ pub(crate) fn request_death( // Queue BR_ERROR if we can't allocate memory for the death notification. let death = UniqueArc::new_uninit(GFP_KERNEL).inspect_err(|_| { thread.push_return_work(BR_ERROR); + binder_debug!( + DeathNotification, + "BC_REQUEST_DEATH_NOTIFICATION failed due to memory allocation failure" + ); })?; let mut refs = self.node_refs.lock(); let Some(info) = refs.by_handle.get_mut(&handle) else { @@ -1296,6 +1300,11 @@ pub(crate) fn request_death( info.node_ref().node.add_death(death, &mut owner_inner); } } + binder_debug!( + DeathNotification, + "BC_REQUEST_DEATH_NOTIFICATION handle {handle} cookie {:016x}", + cookie + ); Ok(()) } @@ -1339,6 +1348,11 @@ pub(crate) fn clear_death(&self, reader: &mut UserSliceReader, thread: &Thread) } } + binder_debug!( + DeathNotification, + "BC_CLEAR_DEATH_NOTIFICATION handle {handle} cookie {:016x}", + cookie + ); Ok(()) } -- 2.55.0.229.g6434b31f56-goog