[PATCH v4 5/7] rust_binder: Implement BINDER_DEBUG_FAILED_TRANSACTION

From: Jahnavi MN via B4 Relay

Date: Thu Jul 16 2026 - 04:40:15 EST


From: Jahnavi MN <jahnavimn@xxxxxxxxxx>

This adds dynamic debug logs for:
- Failed replies, target process deaths, and error code deliveries.
- Detailed transaction failure diagnostics (including sender/receiver
PIDs, TIDs, transaction IDs, buffer sizes, and error codes).

Reviewed-by: Carlos Llamas <cmllamas@xxxxxxxxxx>
Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>
Signed-off-by: Jahnavi MN <jahnavimn@xxxxxxxxxx>
---
drivers/android/binder/thread.rs | 21 ++++++++++++++++-----
drivers/android/binder/transaction.rs | 8 ++++++++
2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/drivers/android/binder/thread.rs b/drivers/android/binder/thread.rs
index 9f0178a13d6f..38b90c79c057 100644
--- a/drivers/android/binder/thread.rs
+++ b/drivers/android/binder/thread.rs
@@ -1275,11 +1275,22 @@ fn transaction(self: &Arc<Self>, cmd: u32, reader: &mut UserSliceReader) -> Resu
}
}

- pr_warn!(
- "{}:{} transaction to {} failed: {err:?}",
- info.from_pid,
- info.from_tid,
- info.to_pid
+ binder_debug!(
+ FailedTransaction,
+ "transaction {} to {}:{} failed {:?}, code {} size {}-{}",
+ if info.is_reply {
+ "reply"
+ } else if info.is_oneway() {
+ "async"
+ } else {
+ "call"
+ },
+ info.to_pid,
+ info.to_tid,
+ err,
+ info.code,
+ info.data_size,
+ info.offsets_size
);
}
}
diff --git a/drivers/android/binder/transaction.rs b/drivers/android/binder/transaction.rs
index afef5b46eac2..069c792d2200 100644
--- a/drivers/android/binder/transaction.rs
+++ b/drivers/android/binder/transaction.rs
@@ -404,6 +404,14 @@ fn do_work(
} else {
// On failure to process the list, we send a reply back to the sender and ignore the
// transaction on the recipient.
+ binder_debug!(
+ FailedTransaction,
+ "transaction {} to {} failed, fd fixups failed, size {}-{}",
+ self.debug_id,
+ self.to.task.pid(),
+ self.data_size,
+ self.offsets_size
+ );
return Ok(true);
};


--
2.55.0.229.g6434b31f56-goog