summaryrefslogtreecommitdiff
path: root/drivers/android/binder/process.rs
diff options
context:
space:
mode:
authorAlice Ryhl <aliceryhl@google.com>2026-09-30 13:56:37 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-10-01 14:34:04 +0200
commit831f1ddd64fa194eb7ddbb67ece363a57daa1537 (patch)
treee0ca2f48a0911aa991256c59b554ff9fd9bddcf5 /drivers/android/binder/process.rs
parent32d0ed324f6fc9428f2942c48ea5d2530e08665a (diff)
rust_binder: track caller location in BinderError
Record the caller's location in BinderError using #[track_caller] and a new ErrorLocation wrapper around &'static Location<'static> across all BinderError constructors and From implementations. ErrorLocation implements Display by stripping the directory prefix so locations are formatted as filename.rs:line (e.g. process.rs:422). In Context::get_manager_node and Process::buffer_alloc, avoid passing BinderError::new_dead() or BinderError::from() as function pointers to Option::ok_or_else() and Result::map_err() so that #[track_caller] captures the call site in rust_binder correctly. Include the error location in the FailedTransaction debug print and prepare for recording it in the binder transaction log. Example output: rust_binder: 840:4583 transaction async to 7656:0 failed ESRCH, code 1 size 428-16 line thread.rs:711 Assisted-by: LLM Signed-off-by: Alice Ryhl <aliceryhl@google.com> Link: https://patch.msgid.link/20260930-binder-transaction-log-v2-2-8a15e9b8cae3@google.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/android/binder/process.rs')
-rw-r--r--drivers/android/binder/process.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/android/binder/process.rs b/drivers/android/binder/process.rs
index a56489d8bfcc..64960857bcdc 100644
--- a/drivers/android/binder/process.rs
+++ b/drivers/android/binder/process.rs
@@ -1071,7 +1071,10 @@ impl Process {
let (new_alloc, addr) = loop {
let mut inner = self.inner.lock();
- let mapping = inner.mapping.as_mut().ok_or_else(BinderError::new_dead)?;
+ let mapping = inner
+ .mapping
+ .as_mut()
+ .ok_or_else(|| BinderError::new_dead())?;
let alloc_request = match mapping.alloc.reserve_new(reserve_new_args)? {
ReserveNew::Success(new_alloc) => break (new_alloc, mapping.address),
ReserveNew::NeedAlloc(request) => request,