Skip to content

Commit ae55f1a

Browse files
committed
rust_binder: Implement BINDER_DEBUG_DEATH_NOTIFICATION
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) Change-Id: I2c7c90dc02808862d0709a95542bb79dd4cd7064 Signed-off-by: Jahnavi MN <jahnavimn@google.com>
1 parent b2ed81f commit ae55f1a

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

drivers/android/binder/node.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,11 @@ impl DeliverToRead for NodeDeath {
11131113
// We're still holding the inner lock, so it cannot be aborted while we insert it into
11141114
// the delivered list.
11151115
process_inner.death_delivered(self.clone());
1116+
binder_debug!(
1117+
DeathNotification,
1118+
"sending death notification, cookie {:016x}",
1119+
cookie
1120+
);
11161121
BR_DEAD_BINDER
11171122
};
11181123

drivers/android/binder/process.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,6 +1267,10 @@ impl Process {
12671267
// Queue BR_ERROR if we can't allocate memory for the death notification.
12681268
let death = UniqueArc::new_uninit(GFP_KERNEL).inspect_err(|_| {
12691269
thread.push_return_work(BR_ERROR);
1270+
binder_debug!(
1271+
DeathNotification,
1272+
"BC_REQUEST_DEATH_NOTIFICATION failed due to memory allocation failure"
1273+
);
12701274
})?;
12711275
let mut refs = self.node_refs.lock();
12721276
let Some(info) = refs.by_handle.get_mut(&handle) else {
@@ -1310,6 +1314,11 @@ impl Process {
13101314
info.node_ref().node.add_death(death, &mut owner_inner);
13111315
}
13121316
}
1317+
binder_debug!(
1318+
DeathNotification,
1319+
"BC_REQUEST_DEATH_NOTIFICATION handle {handle} cookie {:016x}",
1320+
cookie
1321+
);
13131322
Ok(())
13141323
}
13151324

@@ -1353,6 +1362,11 @@ impl Process {
13531362
}
13541363
}
13551364

1365+
binder_debug!(
1366+
DeathNotification,
1367+
"BC_CLEAR_DEATH_NOTIFICATION handle {handle} cookie {:016x}",
1368+
cookie
1369+
);
13561370
Ok(())
13571371
}
13581372

0 commit comments

Comments
 (0)